]> granicus.if.org Git - nethack/commitdiff
don't dereference NULL u.ustuck in dobuzz()
authornhmall <nhmall@nethack.org>
Wed, 9 Feb 2022 10:47:08 +0000 (05:47 -0500)
committernhmall <nhmall@nethack.org>
Wed, 9 Feb 2022 10:47:08 +0000 (05:47 -0500)
doc/fixes3-7-0.txt
src/zap.c

index a81de9e4b2c6835c1170e9ad2bdfb58e8b6a87a6..3c1026ccc54909bde461abe52fa1346aa62e29ea 100644 (file)
@@ -773,6 +773,7 @@ in flush_screen, reorder the code slightly to complete the bot() and
 magic traps can toggle intrinsic invisibility
 Death attacking a monster does drain life attack
 add unique Rider revival messages
+don't dereference NULL u.ustuck in dobuzz() when hero has been swallowed
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index e4497f38203673f1392da379c28fb25da749e4eb..d8b4089e2a87e3ced79a79e5297887f7400da237 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -4252,16 +4252,17 @@ dobuzz(int type, int nd, xchar sx, xchar sy, int dx, int dy,
         if (type < 0)
             return;
         tmp = zhitm(u.ustuck, type, nd, &otmp);
-        if (!u.ustuck)
+        if (!u.ustuck) {
             u.uswallow = 0;
-        else
+        } else {
             pline("%s rips into %s%s", The(fltxt), mon_nam(u.ustuck),
                   exclam(tmp));
-        /* Using disintegration from the inside only makes a hole... */
-        if (tmp == MAGIC_COOKIE)
-            u.ustuck->mhp = 0;
-        if (DEADMONSTER(u.ustuck))
-            killed(u.ustuck);
+            /* Using disintegration from the inside only makes a hole... */
+            if (tmp == MAGIC_COOKIE)
+                u.ustuck->mhp = 0;
+            if (DEADMONSTER(u.ustuck))
+                killed(u.ustuck);
+       }
         return;
     }
     if (type < 0)