fix #H8072 - failing wish segfaults

Having an artifact wish be refused uses zeroobj and code which
followed was attempting to update its weight, triggering a segfault
now that zeroobj is 'const'.
This commit is contained in:
PatR
2019-01-28 09:10:52 -08:00
parent 1083971228
commit 30237c73ec
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.237 $ $NHDT-Date: 1548631703 2019/01/27 23:28:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.239 $ $NHDT-Date: 1548695445 2019/01/28 17:10:45 $
This fixes36.2 file is here to capture information about updates in the 3.6.x This fixes36.2 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.1 in April 2018. Please note, however, lineage following the release of 3.6.1 in April 2018. Please note, however,
@@ -410,6 +410,8 @@ when engulfed while in a shop, dropping an item into the engulfer and then
using ':' to look at current location could cause a crash using ':' to look at current location could cause a crash
when items were on the floor just inside a shop's door where the shopkeeper when items were on the floor just inside a shop's door where the shopkeeper
doesn't buy and sell stuff, those items showed a 'for sale' price doesn't buy and sell stuff, those items showed a 'for sale' price
having an artifact wish be refused ("for a moment you feel <artifact> in
your hands, but it disappears") would immediately segfault
tty: turn off an optimization that is the suspected cause of Windows reported tty: turn off an optimization that is the suspected cause of Windows reported
partial status lines following level changes partial status lines following level changes
tty: ensure that current status fields are always copied to prior status tty: ensure that current status fields are always copied to prior status
+2 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1547025168 2019/01/09 09:12:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.233 $ */ /* NetHack 3.6 objnam.c $NHDT-Date: 1548695445 2019/01/28 17:10:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.234 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3984,6 +3984,7 @@ struct obj *no_wish;
otmp = (struct obj *) &zeroobj; otmp = (struct obj *) &zeroobj;
pline("For a moment, you feel %s in your %s, but it disappears!", pline("For a moment, you feel %s in your %s, but it disappears!",
something, makeplural(body_part(HAND))); something, makeplural(body_part(HAND)));
return otmp;
} }
if (halfeaten && otmp->oclass == FOOD_CLASS) { if (halfeaten && otmp->oclass == FOOD_CLASS) {