Add null check for English name
This commit is contained in:
parent
08d37eb6de
commit
f47c6505ab
2 changed files with 3 additions and 3 deletions
|
|
@ -437,7 +437,7 @@ namespace TShockAPI
|
|||
|| nameLower == englishName)
|
||||
return new List<NPC> { npc };
|
||||
if (npc.FullName.ToLowerInvariant().StartsWith(nameLower) || npc.TypeName.ToLowerInvariant().StartsWith(nameLower)
|
||||
|| englishName.StartsWith(nameLower))
|
||||
|| englishName?.StartsWith(nameLower) == true)
|
||||
found.Add((NPC)npc.Clone());
|
||||
}
|
||||
return found;
|
||||
|
|
@ -516,7 +516,7 @@ namespace TShockAPI
|
|||
string englishName = EnglishLanguage.GetPrefixById(i).ToLowerInvariant();
|
||||
if (prefixName == lowerName || englishName == lowerName)
|
||||
return new List<int>() { i };
|
||||
else if (prefixName.StartsWith(lowerName) || englishName.StartsWith(lowerName)) // Partial match
|
||||
else if (prefixName.StartsWith(lowerName) || englishName?.StartsWith(lowerName) == true) // Partial match
|
||||
found.Add(i);
|
||||
}
|
||||
return found;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue