From 3bedf79222e3685c69e64b04d35bae5400718d6a Mon Sep 17 00:00:00 2001 From: Emile Belanger Date: Thu, 12 May 2022 19:18:44 +0100 Subject: [PATCH] Fix crash when loading Strife dialog with latest Clang compiler and optimisation on --- src/maploader/strifedialogue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maploader/strifedialogue.cpp b/src/maploader/strifedialogue.cpp index 247aaa5a9..181405bb5 100644 --- a/src/maploader/strifedialogue.cpp +++ b/src/maploader/strifedialogue.cpp @@ -345,7 +345,7 @@ FStrifeDialogueNode *MapLoader::ReadRetailNode (const char *name, FileReader &lu for (j = 0; j < 3; ++j) { auto inv = GetStrifeType(speech.ItemCheck[j]); - if (!inv->IsDescendantOf(NAME_Inventory)) inv = nullptr; + if (inv == NULL || !inv->IsDescendantOf(NAME_Inventory)) inv = nullptr; node->ItemCheck[j].Item = inv; node->ItemCheck[j].Amount = -1; } @@ -516,7 +516,7 @@ void MapLoader::ParseReplies (const char *name, int pos, FStrifeDialogueReply ** for (k = 0; k < 3; ++k) { auto inv = GetStrifeType(rsp->Item[k]); - if (!inv->IsDescendantOf(NAME_Inventory)) inv = nullptr; + if (inv == NULL || !inv->IsDescendantOf(NAME_Inventory)) inv = nullptr; reply->ItemCheck[k].Item = inv; reply->ItemCheck[k].Amount = rsp->Count[k]; }