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

View 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

View File

@@ -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)