shithub: choc

Download patch

ref: 15201415b824c3bc80bdaceeedab3f5002e8a905
parent: fdd360aa5cc5d14602a1cb8170453141ebdda9d7
author: Jason Benaim <[email protected]>
date: Sat Dec 1 15:53:36 EST 2018

Doom: don't divide by zero, but call I_Error instead.

--- a/src/doom/p_enemy.c
+++ b/src/doom/p_enemy.c
@@ -1909,6 +1909,10 @@
 		
     // shoot a cube at current target
     targ = braintargets[braintargeton];
+    if (numbraintargets == 0) {
+        I_Error("A_BrainSpit: numbraintargets was 0 (vanilla crashes here)");
+        return;
+    }
     braintargeton = (braintargeton+1)%numbraintargets;
 
     // spawn brain missile