From 5fc5c81c0832b814c7ef67099ff2dd7b497ef0c1 Mon Sep 17 00:00:00 2001 From: John Johns Date: Mon, 31 May 2021 16:15:26 -0700 Subject: [PATCH] Hoikas' fix for crash when triggering missing animation https://github.com/H-uru/Plasma/pull/103 --- .../Plasma/PubUtilLib/plAvatar/plAnimStage.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp index 4a6c9814..0b481513 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp @@ -424,6 +424,14 @@ bool plAnimStage::IMoveBackward(double time, float delta, float &overrun, plArma bool infiniteLoop = fLoops == -1; bool loopsRemain = fCurLoop > 0 || infiniteLoop; + // If we don't have this animation, just pretend to have worked. + // Otherwise, we crash the client. + if (!fAnimInstance) + { + hsAssert(false, "AnimInstance nil"); + return true; + } + // This must be here before we set the local time. if (fAnimInstance->GetTimeConvert()) fAnimInstance->GetTimeConvert()->Backwards(); @@ -476,6 +484,14 @@ bool plAnimStage::IMoveForward(double time, float delta, float &overrun, plArmat // first get the target time in local time, ignoring overruns float target = fLocalTime + delta; + // If we don't have this animation, just pretend to have worked. + // Otherwise, we crash the client. + if (!fAnimInstance) + { + hsAssert(false, "AnimInstance nil"); + return true; + } + if (fAnimInstance->GetTimeConvert()) fAnimInstance->GetTimeConvert()->Forewards();