From 9aa87aee05b1735c50ff6a891a860abe126db65e Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 16 Dec 2023 10:04:13 -0500 Subject: [PATCH] static analyzer bit Make it really obvious to the analyzer that we're only calling canseemon(mcarry) when mcarry is not null. --- src/do.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/do.c b/src/do.c index 17f1a38ee..7a20e1d1c 100644 --- a/src/do.c +++ b/src/do.c @@ -2077,6 +2077,8 @@ revive_corpse(struct obj *corpse) chewed ? "bite-covered" : (const char *) 0, CXN_SINGULAR)); mcarry = (where == OBJ_MINVENT) ? corpse->ocarry : 0; + /* mcarry is NULL for (where == OBJ_BURIED and OBJ_CONTAINED) now */ + (void) get_obj_location(corpse, &corpsex, &corpsey, CONTAINED_TOO | BURIED_TOO); @@ -2125,7 +2127,7 @@ revive_corpse(struct obj *corpse) case OBJ_MINVENT: /* probably a nymph's */ if (cansee(mtmp->mx, mtmp->my)) { - if (canseemon(mcarry)) + if (mcarry && canseemon(mcarry)) pline("Startled, %s drops %s as it %s!", mon_nam(mcarry), an(cname), canspotmon(mtmp) ? "revives" : "disappears");