From: Côme Chilliet Date: Sat, 10 Dec 2016 17:57:04 +0000 (+0700) Subject: Attempt at fixing the crash in DoAnimation X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=e17f6de5a688aca221360f8dd4a257be78e114f0;p=lugaru.git Attempt at fixing the crash in DoAnimation --- diff --git a/Source/Person.cpp b/Source/Person.cpp index a9b5983..acd6647 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -4181,6 +4181,9 @@ void Person::DoAnimations() oldrot = 0; targetrot = 0; } + if (frameCurrent >= Animation::animations[animCurrent].frames.size()) { + frameCurrent = Animation::animations[animCurrent].frames.size() - 1; + } if (animCurrent != oldanimCurrent || animTarget != oldanimTarget || ((frameCurrent != oldframeCurrent || frameTarget != oldframeTarget) && !calcrot)) { //Old rotates for (int i = 0; i < skeleton.joints.size(); i++) { @@ -4234,9 +4237,6 @@ void Person::DoAnimations() } } } - if (frameCurrent >= Animation::animations[animCurrent].frames.size()) { - frameCurrent = Animation::animations[animCurrent].frames.size() - 1; - } oldanimCurrent = animCurrent; oldanimTarget = animTarget;