Skip to content

Commit 010c441

Browse files
authored
Catch crash if animation speed is 0 (#710)
1 parent 0a5e76b commit 010c441

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

prboom2/src/p_spec.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,22 @@ void P_InitPicAnims (void)
246246

247247
lastanim->istexture = animdefs[i].istexture;
248248
lastanim->numpics = lastanim->picnum - lastanim->basepic + 1;
249+
lastanim->speed = LittleLong(animdefs[i].speed);
249250

250251
// [crispy] skip reading SMMU swirling flats
251252
if (lastanim->speed < 65536 && lastanim->numpics != 1)
252-
{
253+
{
253254
if (lastanim->numpics < 2)
254255
I_Error ("P_InitPicAnims: bad cycle from %s to %s",
255256
animdefs[i].startname,
256257
animdefs[i].endname);
257258
}
258-
lastanim->speed = LittleLong(animdefs[i].speed); // killough 5/5/98: add LONG()
259+
260+
if (lastanim->speed == 0)
261+
I_Error ("P_InitPicAnims: %s to %s animation cannot have speed 0",
262+
animdefs[i].startname,
263+
animdefs[i].endname);
264+
259265
lastanim++;
260266
}
261267

0 commit comments

Comments
 (0)