From 500af49dd3e5b0244e5d0e48e81749b72f3d6dd6 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 5 Apr 2025 09:44:02 -0700 Subject: [PATCH] fix issue #1407 - mon throw-and-return crash Issue reported by k21971: a gnome throwing a wielded aklys at the hero was killed when failing to catch its return. Bookkeeping for dead monsters got messed up, then a crash occurred. This fixes things. Instead of a comment stating that the thrower might be dead, kill it off. --- src/mthrowu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mthrowu.c b/src/mthrowu.c index 4313ce8d7..092264c35 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -904,7 +904,8 @@ return_from_mtoss(struct monst *magr, struct obj *otmp, boolean tethered_weapon) if (otmp->oartifact) (void) artifact_hit((struct monst *) 0, magr, otmp, &dmg, 0); magr->mhp -= dmg; - /* magr could be a DEADMONSTER now */ + if (DEADMONSTER(magr)) + monkilled(magr, canspotmon(magr) ? "" : (char *) 0, AD_PHYS); } if (notcaught) { (void) snuff_candle(otmp);