fix issue #509 - shop 'glob' pricing segfault
A recent change made it possible for a glob to have its dknown flag cleared and that exposed globby_bill_fixup() passing Null shopkeeper to get_cost(), triggering a crash. Make the routine that clears dknown/known/bknown/&c also be the routine used to initialize those flags for a new object so that it is the place that handles various special cases. That hides the shop bug again. But also fix the shop bug even though it won't be triggered. Fixes #509
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 shk.c $NHDT-Date: 1610667899 2021/01/14 23:44:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.195 $ */
|
||||
/* NetHack 3.7 shk.c $NHDT-Date: 1620861209 2021/05/12 23:13:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.197 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -4740,7 +4740,7 @@ globby_bill_fixup(struct obj* obj_absorber, struct obj* obj_absorbed)
|
||||
struct bill_x *bp, *bp_absorber = (struct bill_x *) 0;
|
||||
struct monst *shkp = 0;
|
||||
struct eshk *eshkp;
|
||||
long amount, per_unit_cost = set_cost(obj_absorbed, shkp);
|
||||
long amount, per_unit_cost;
|
||||
boolean floor_absorber = (obj_absorber->where == OBJ_FLOOR);
|
||||
|
||||
if (!obj_absorber->globby)
|
||||
@@ -4769,6 +4769,7 @@ globby_bill_fixup(struct obj* obj_absorber, struct obj* obj_absorbed)
|
||||
bp_absorber = onbill(obj_absorber, shkp, FALSE);
|
||||
bp = onbill(obj_absorbed, shkp, FALSE);
|
||||
eshkp = ESHK(shkp);
|
||||
per_unit_cost = set_cost(obj_absorbed, shkp);
|
||||
|
||||
/**************************************************************
|
||||
* Scenario 1. Shop-owned glob absorbing into shop-owned glob
|
||||
|
||||
Reference in New Issue
Block a user