analysis lint for u*.c
One actual bug: mhitm_ad_ench() could pass Null to drain_item() which was not prepared to deal with that.
This commit is contained in:
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 u_init.c $NHDT-Date: 1725227809 2024/09/01 21:56:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.111 $ */
|
/* NetHack 3.7 u_init.c $NHDT-Date: 1737620595 2025/01/23 00:23:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.113 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2017. */
|
/*-Copyright (c) Robert Patrick Rankin, 2017. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1329,6 +1329,7 @@ ini_inv(struct trobj *trop)
|
|||||||
* it was UNDEF_TYP or not after this. */
|
* it was UNDEF_TYP or not after this. */
|
||||||
|
|
||||||
otyp = ini_inv_obj_substitution(trop, obj);
|
otyp = ini_inv_obj_substitution(trop, obj);
|
||||||
|
nhUse(otyp);
|
||||||
|
|
||||||
/* nudist gets no armor */
|
/* nudist gets no armor */
|
||||||
if (u.uroleplay.nudist && obj->oclass == ARMOR_CLASS) {
|
if (u.uroleplay.nudist && obj->oclass == ARMOR_CLASS) {
|
||||||
|
|||||||
+8
-3
@@ -1813,8 +1813,10 @@ hmon_hitmon(
|
|||||||
|
|
||||||
hmon_hitmon_msg_hit(&hmd, mon, obj);
|
hmon_hitmon_msg_hit(&hmd, mon, obj);
|
||||||
|
|
||||||
if (hmd.dryit) /* dryit implies wet towel, so 'obj' is still intact */
|
if (hmd.dryit) { /* dryit implies wet towel, so 'obj' is still intact */
|
||||||
|
assert(obj != NULL);
|
||||||
dry_a_towel(obj, -1, TRUE);
|
dry_a_towel(obj, -1, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
if (hmd.silvermsg)
|
if (hmd.silvermsg)
|
||||||
hmon_hitmon_msg_silver(&hmd, mon, obj);
|
hmon_hitmon_msg_silver(&hmd, mon, obj);
|
||||||
@@ -1826,8 +1828,10 @@ hmon_hitmon(
|
|||||||
obj->opoisoned was cleared above and any message referring to
|
obj->opoisoned was cleared above and any message referring to
|
||||||
"poisoned <obj>" has now been given; we want just "<obj>" for
|
"poisoned <obj>" has now been given; we want just "<obj>" for
|
||||||
last message, so reformat while obj is still accessible */
|
last message, so reformat while obj is still accessible */
|
||||||
if (hmd.unpoisonmsg)
|
if (hmd.unpoisonmsg) {
|
||||||
|
assert(obj != NULL);
|
||||||
Strcpy(hmd.saved_oname, cxname(obj));
|
Strcpy(hmd.saved_oname, cxname(obj));
|
||||||
|
}
|
||||||
|
|
||||||
/* [note: thrown obj might go away during killed()/xkilled() call
|
/* [note: thrown obj might go away during killed()/xkilled() call
|
||||||
(via 'thrownobj'; if swallowed, it gets added to engulfer's
|
(via 'thrownobj'; if swallowed, it gets added to engulfer's
|
||||||
@@ -3508,6 +3512,7 @@ mhitm_ad_slim(
|
|||||||
mhm->damage = 0;
|
mhm->damage = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nhUse(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -3549,7 +3554,7 @@ mhitm_ad_ench(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (drain_item(obj, FALSE)) {
|
if (obj && drain_item(obj, FALSE)) {
|
||||||
pline("%s less effective.", Yobjnam2(obj, "seem"));
|
pline("%s less effective.", Yobjnam2(obj, "seem"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user