fixed bug which could cause division by zero
[rocksndiamonds.git] / src / tools.c
index 3af2b5f9220a853757939b8c7664fea97427eeb8..247bcffd33d5a9de7d3a2afb9fce86270feabea0 100644 (file)
@@ -4184,6 +4184,8 @@ unsigned int MoveDoor(unsigned int door_state)
       }
     }
 
+    max_step_delay = MAX(1, max_step_delay);   // prevent division by zero
+
     num_move_steps = max_move_delay / max_step_delay;
     num_move_steps_doors_only = max_move_delay_doors_only / max_step_delay;