null pointer crash fix

The fix to try to avoid messages about out-of-view objects taking
erosion damage made water_damage_chain() vulnerable to dereferencing
a null pointer, leading to a crash if you create a pool via wizard
mode wishing.
This commit is contained in:
PatR
2020-04-08 14:53:06 -07:00
parent 6582b90008
commit 69b4f0afc0
2 changed files with 6 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1586285683 2020/04/07 18:54:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.357 $ */
/* NetHack 3.6 trap.c $NHDT-Date: 1586382778 2020/04/08 21:52:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.358 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3682,6 +3682,9 @@ boolean here;
struct obj *otmp;
xchar x, y;
if (!obj)
return;
/* initialize acid context: so far, neither seen (dknown) potions of
acid nor unseen have exploded during this water damage sequence */
g.acid_ctx.dkn_boom = g.acid_ctx.unk_boom = 0;