Add null checks for name hashing to help avoid crashes for some resources

This commit is contained in:
dexy 2022-03-20 11:09:24 +11:00
parent 8998b8c808
commit a12ccd6947
2 changed files with 2 additions and 1 deletions

View File

@ -288,7 +288,7 @@ namespace CodeWalker.GameFiles
{ }
NameHash = _CMapTypes.name;
if (NameHash == 0)
if ((NameHash == 0) && (entry.NameLower != null))
{
int ind = entry.NameLower.LastIndexOf('.');
if (ind > 0)

View File

@ -57,6 +57,7 @@ namespace CodeWalker.GameFiles
public static uint GenHash(string text)
{
if (text == null) return 0;
uint h = 0;
for (int i = 0; i < text.Length; i++)
{