mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 20:54:16 +01:00
review: _selectedModIndex fix, redundant initialization removed.
This commit is contained in:
parent
d24fed6eb9
commit
3df3675500
2 changed files with 14 additions and 5 deletions
|
|
@ -156,9 +156,6 @@ namespace Penumbra.Mods
|
||||||
var entry = new ModInfo
|
var entry = new ModInfo
|
||||||
{
|
{
|
||||||
Priority = ModSettings.Count,
|
Priority = ModSettings.Count,
|
||||||
CurrentGroup = 0,
|
|
||||||
CurrentTop = 0,
|
|
||||||
CurrentBottom = 0,
|
|
||||||
FolderName = mod.ModBasePath.Name,
|
FolderName = mod.ModBasePath.Name,
|
||||||
Enabled = true,
|
Enabled = true,
|
||||||
Mod = mod
|
Mod = mod
|
||||||
|
|
|
||||||
|
|
@ -268,6 +268,8 @@ namespace Penumbra.UI
|
||||||
if( ImGui.Button( "Rediscover Mods" ) )
|
if( ImGui.Button( "Rediscover Mods" ) )
|
||||||
{
|
{
|
||||||
ReloadMods();
|
ReloadMods();
|
||||||
|
_selectedModIndex = 0;
|
||||||
|
_selectedMod = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
@ -554,8 +556,18 @@ namespace Penumbra.UI
|
||||||
if( ImGui.Button( "Reload JSON" ) )
|
if( ImGui.Button( "Reload JSON" ) )
|
||||||
{
|
{
|
||||||
ReloadMods();
|
ReloadMods();
|
||||||
|
|
||||||
|
// May select a different mod than before if mods were added or deleted, but will not crash.
|
||||||
|
if (_selectedModIndex < _plugin.ModManager.Mods.ModSettings.Count)
|
||||||
|
{
|
||||||
_selectedMod = _plugin.ModManager.Mods.ModSettings[_selectedModIndex];
|
_selectedMod = _plugin.ModManager.Mods.ModSettings[_selectedModIndex];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_selectedModIndex = 0;
|
||||||
|
_selectedMod = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawGroupSelectors()
|
private void DrawGroupSelectors()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue