diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index f8001a8ba..bd6f10683 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1928,8 +1928,10 @@ static void doPlayerActionSequence(DExhumedPlayer* const pPlayer) const auto pPlayerActor = pPlayer->GetActor(); const auto playerSeq = getSequence(pPlayerActor->nSeqFile, PlayerSeq[pPlayerActor->nAction].nSeqId); - const auto& seqFrame = playerSeq->frames[pPlayerActor->nFrame]; + if (playerSeq == nullptr) return; const auto seqSize = playerSeq->frames.Size(); + if (pPlayerActor->nFrame >= seqSize) pPlayerActor->nFrame = seqSize - 1; + const auto& seqFrame = playerSeq->frames[pPlayerActor->nFrame]; seqFrame.playSound(pPlayerActor); pPlayerActor->nFrame++; diff --git a/source/games/exhumed/src/sequence.h b/source/games/exhumed/src/sequence.h index 146c04e16..46530e422 100644 --- a/source/games/exhumed/src/sequence.h +++ b/source/games/exhumed/src/sequence.h @@ -88,7 +88,9 @@ TArray* getFileSeqs(const FName nSeqFile); inline Seq* getSequence(const FName nSeqFile, const unsigned nSeqIndex = 0) { - return getFileSeqs(nSeqFile)->Data(nSeqIndex); + auto seq = getFileSeqs(nSeqFile); + if (nSeqIndex >= seq->Size()) return nullptr; + return seq->Data(nSeqIndex); } END_PS_NS