mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-26 05:51:30 +00:00
Exhumed: fix crash on bad player animation sequence.
This commit is contained in:
parent
86584b54ec
commit
0666e3372c
2 changed files with 6 additions and 2 deletions
|
@ -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++;
|
||||
|
|
|
@ -88,7 +88,9 @@ TArray<Seq>* 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
|
||||
|
|
Loading…
Reference in a new issue