shithub: choc

Download patch

ref: b4f996361a018e72931c4389b8fd67e6d716a4dc
parent: fdd360aa5cc5d14602a1cb8170453141ebdda9d7
parent: 07d86dc88838a3653f5a4b9fc07663bcab906958
author: Jonathan Dowland <jon+github@alcopop.org>
date: Sun Dec 2 03:57:27 EST 2018

Merge pull request #1113 from jkbenaim/fix-spawncube-crash

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)");
+    }
     braintargeton = (braintargeton+1)%numbraintargets;
 
     // spawn brain missile