From a12ccd6947188761fff3e283b2b3eebdb6532039 Mon Sep 17 00:00:00 2001 From: dexy Date: Sun, 20 Mar 2022 11:09:24 +1100 Subject: [PATCH] Add null checks for name hashing to help avoid crashes for some resources --- CodeWalker.Core/GameFiles/FileTypes/YtypFile.cs | 2 +- CodeWalker.Core/GameFiles/Utils/Jenk.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CodeWalker.Core/GameFiles/FileTypes/YtypFile.cs b/CodeWalker.Core/GameFiles/FileTypes/YtypFile.cs index 9da400f..5fff26d 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/YtypFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/YtypFile.cs @@ -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) diff --git a/CodeWalker.Core/GameFiles/Utils/Jenk.cs b/CodeWalker.Core/GameFiles/Utils/Jenk.cs index 4129e96..00164e8 100644 --- a/CodeWalker.Core/GameFiles/Utils/Jenk.cs +++ b/CodeWalker.Core/GameFiles/Utils/Jenk.cs @@ -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++) {