Fix crash when loading Strife dialog with latest Clang compiler and optimisation on

This commit is contained in:
Emile Belanger 2022-05-12 19:18:44 +01:00 committed by Christoph Oelckers
parent beeb5f00aa
commit 3bedf79222
1 changed files with 2 additions and 2 deletions

View File

@ -345,7 +345,7 @@ FStrifeDialogueNode *MapLoader::ReadRetailNode (const char *name, FileReader &lu
for (j = 0; j < 3; ++j) for (j = 0; j < 3; ++j)
{ {
auto inv = GetStrifeType(speech.ItemCheck[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].Item = inv;
node->ItemCheck[j].Amount = -1; node->ItemCheck[j].Amount = -1;
} }
@ -516,7 +516,7 @@ void MapLoader::ParseReplies (const char *name, int pos, FStrifeDialogueReply **
for (k = 0; k < 3; ++k) for (k = 0; k < 3; ++k)
{ {
auto inv = GetStrifeType(rsp->Item[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].Item = inv;
reply->ItemCheck[k].Amount = rsp->Count[k]; reply->ItemCheck[k].Amount = rsp->Count[k];
} }