Skip to content

Commit

Permalink
Fix crash in GetEditorDisplayName when ININame starts with AI and Nam…
Browse files Browse the repository at this point in the history
…e is null
  • Loading branch information
Rampastring committed Aug 22, 2023
1 parent c009019 commit e3336ae
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/TSMapEditor/Models/GameObjectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ public string GetEditorDisplayName()
{
string name;

if (string.IsNullOrWhiteSpace(FSName))
name = Name ?? ININame;
else
if (!string.IsNullOrWhiteSpace(FSName))
{
name = FSName;
}
else if (!string.IsNullOrWhiteSpace(Name))
{
name = Name;
}
else
{
return ININame;
}

if (ININame.StartsWith("AI") && !Name.StartsWith("AI"))
if (ININame.StartsWith("AI") && !name.StartsWith("AI "))
return "AI " + name;

return name;
Expand Down

0 comments on commit e3336ae

Please sign in to comment.