|
From: Crossfire C. r. messages.
<cro...@li...> - 2018-11-19 00:53:20
|
Revision: 20610
http://sourceforge.net/p/crossfire/code/20610
Author: partmedia
Date: 2018-11-19 00:53:14 +0000 (Mon, 19 Nov 2018)
Log Message:
-----------
Check for divide by zero
Modified Paths:
--------------
client/trunk/common/mapdata.c
Modified: client/trunk/common/mapdata.c
===================================================================
--- client/trunk/common/mapdata.c 2018-11-19 00:52:57 UTC (rev 20609)
+++ client/trunk/common/mapdata.c 2018-11-19 00:53:14 UTC (rev 20610)
@@ -861,7 +861,13 @@
/* Random animation is pretty easy */
if ((anim & ANIM_FLAGS_MASK) == ANIM_RANDOM) {
- phase = g_random_int() % animations[animation].num_animations;
+ const guint8 num_animations = animations[animation].num_animations;
+ if (num_animations == 0) {
+ LOG(LOG_WARNING, "mapdata_set_anim_layer",
+ "animating object with zero animations");
+ return;
+ }
+ phase = g_random_int() % num_animations;
face = animations[animation].faces[phase];
speed_left = anim_speed % g_random_int();
} else if ((anim & ANIM_FLAGS_MASK) == ANIM_SYNC) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|