From d918d329eaf1230ca5ba758531613f3698f5a108 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 30 Jun 2009 08:22:40 +0000 Subject: [PATCH] missile vs engulfer (trunk only) Noticed while testing the " is no longer poisoned" fix; killing an engulfer via "the poison was deadly..." led to an "obj not free" panic. It was due to post-3.4.3 changes, so no fixes entry. --- src/dothrow.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dothrow.c b/src/dothrow.c index 979d7993b..fc7af5735 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,5 +1,4 @@ /* NetHack 3.5 dothrow.c $Date$ $Revision$ */ -/* SCCS Id: @(#)dothrow.c 3.5 2009/01/22 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1416,6 +1415,11 @@ register struct obj *obj; /* thrownobj or kickobj or uwep */ cutworm(mon, bhitpos.x, bhitpos.y, obj); } exercise(A_DEX, TRUE); + /* if hero is swallowed and projectile kills the engulfer, + obj gets added to engulfer's inventory and then dropped, + so we can't safely use that pointer anymore; it escapes + the chance to be used up here... */ + if (!thrownobj) return 1; /* projectiles other than magic stones sometimes disappear when thrown */ if (objects[otyp].oc_skill < P_NONE &&