Fix possible nullref exception

This commit is contained in:
Lwmte 2023-06-02 22:33:47 +02:00
parent 335d29ec61
commit 258970a406

View file

@ -331,9 +331,9 @@ void PuzzleDoneCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* co
void PuzzleDone(ItemInfo* item, short itemNumber) void PuzzleDone(ItemInfo* item, short itemNumber)
{ {
auto triggerIndex = GetTriggerIndex(item); auto triggerIndex = GetTriggerIndex(item);
short triggerType = (*(triggerIndex++) >> 8) & TRIGGER_BITS; short triggerType = (triggerIndex != nullptr) ? (*(triggerIndex++) >> 8) & TRIGGER_BITS : TRIGGER_TYPES::TRIGGER;
if (triggerIndex != nullptr && triggerType == TRIGGER_TYPES::SWITCH) if (triggerType == TRIGGER_TYPES::SWITCH)
{ {
item->ItemFlags[1] = true; item->ItemFlags[1] = true;