shithub: choc

Download patch

ref: 2d6b1a9263855eb78d5dcd35feeab36bb4c1f0f9
parent: 09c8d7e8d57c84f59500e0e6a8ee0686c20a3148
author: Simon Howard <fraggle@gmail.com>
date: Sat Oct 26 16:50:55 EDT 2013

Don't crash Heretic in A_SkullPop() if a player is gibbed and respawns
before the head separates from the body (thanks Tumlee).

Subversion-branch: /branches/v2-branch
Subversion-revision: 2720

--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -2567,9 +2567,17 @@
     mo->player = player;
     mo->health = actor->health;
     mo->angle = actor->angle;
-    player->mo = mo;
-    player->lookdir = 0;
-    player->damagecount = 32;
+
+    // fraggle: This check wasn't originally here in the Vanilla Heretic
+    // source, causing crashes if the player respawns before this
+    // function is called.
+
+    if (player != NULL)
+    {
+        player->mo = mo;
+        player->lookdir = 0;
+        player->damagecount = 32;
+    }
 }
 
 //----------------------------------------------------------------------------