don't dereference NULL u.ustuck in dobuzz()

This commit is contained in:
nhmall
2022-02-09 05:47:08 -05:00
parent 2c7fa4a704
commit 0e9ecb88fb
2 changed files with 9 additions and 7 deletions
+1
View File
@@ -773,6 +773,7 @@ in flush_screen, reorder the code slightly to complete the bot() and
magic traps can toggle intrinsic invisibility magic traps can toggle intrinsic invisibility
Death attacking a monster does drain life attack Death attacking a monster does drain life attack
add unique Rider revival messages 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 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+8 -7
View File
@@ -4252,16 +4252,17 @@ dobuzz(int type, int nd, xchar sx, xchar sy, int dx, int dy,
if (type < 0) if (type < 0)
return; return;
tmp = zhitm(u.ustuck, type, nd, &otmp); tmp = zhitm(u.ustuck, type, nd, &otmp);
if (!u.ustuck) if (!u.ustuck) {
u.uswallow = 0; u.uswallow = 0;
else } else {
pline("%s rips into %s%s", The(fltxt), mon_nam(u.ustuck), pline("%s rips into %s%s", The(fltxt), mon_nam(u.ustuck),
exclam(tmp)); exclam(tmp));
/* Using disintegration from the inside only makes a hole... */ /* Using disintegration from the inside only makes a hole... */
if (tmp == MAGIC_COOKIE) if (tmp == MAGIC_COOKIE)
u.ustuck->mhp = 0; u.ustuck->mhp = 0;
if (DEADMONSTER(u.ustuck)) if (DEADMONSTER(u.ustuck))
killed(u.ustuck); killed(u.ustuck);
}
return; return;
} }
if (type < 0) if (type < 0)