Skip to content

Commit

Permalink
Fix InitEditorOverrides causing a NullReferenceException
Browse files Browse the repository at this point in the history
  • Loading branch information
ZivDero committed Aug 28, 2023
1 parent bc7370c commit e1d82e9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/TSMapEditor/Models/Rules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,25 @@ public void InitEditorOverrides(IniFile iniFile)
gameObjectTypes.AddRange(SmudgeTypes);

var section = iniFile.GetSection("ObjectCategoryOverrides");
foreach (var keyValuePair in section.Keys)
if (section != null)
{
var obj = gameObjectTypes.Find(o => o.ININame == keyValuePair.Key);
if (obj != null)
obj.EditorCategory = keyValuePair.Value;
foreach (var keyValuePair in section.Keys)
{
var obj = gameObjectTypes.Find(o => o.ININame == keyValuePair.Key);
if (obj != null)
obj.EditorCategory = keyValuePair.Value;
}
}

section = iniFile.GetSection("IgnoreTypes");
foreach (var keyValuePair in section.Keys)
if (section != null)
{
var obj = gameObjectTypes.Find(o => o.ININame == keyValuePair.Key);
if (obj != null)
obj.EditorVisible = !section.GetBooleanValue(keyValuePair.Key, !obj.EditorVisible);
foreach (var keyValuePair in section.Keys)
{
var obj = gameObjectTypes.Find(o => o.ININame == keyValuePair.Key);
if (obj != null)
obj.EditorVisible = !section.GetBooleanValue(keyValuePair.Key, !obj.EditorVisible);
}
}
}

Expand Down

0 comments on commit e1d82e9

Please sign in to comment.