From 845cee2578c16e411e89925272220c4d8934b576 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:57:00 +0500 Subject: [PATCH] utils: mdldec: smd.c: prevent division by zero. --- utils/mdldec/smd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/mdldec/smd.c b/utils/mdldec/smd.c index a21260db..43c533c4 100644 --- a/utils/mdldec/smd.c +++ b/utils/mdldec/smd.c @@ -440,9 +440,12 @@ static void WriteFrameInfo( FILE *fp, mstudioanim_t *anim, mstudioseqdesc_t *seq if( bone->parent == -1 ) { - scale = frame / (float)( seqdesc->numframes - 1 ); + if( seqdesc->numframes > 1 && frame > 0 ) + { + scale = frame / (float)( seqdesc->numframes - 1 ); - VectorMA( motion, scale, seqdesc->linearmovement, motion ); + VectorMA( motion, scale, seqdesc->linearmovement, motion ); + } ProperBoneRotationZ( motion, 270.0f ); }