From 2ba42cf78c5b0004c88fc3788a8e7a5559e80d90 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 31 May 2024 10:28:41 +0300 Subject: [PATCH] Fix accessing freed landmine trap Landmine blew up, scatter exploded a potion of oil, which melted the ice on which the landmine was, resulting in the landmine trap being deleted. The code then tried to access it to make a pit. --- src/trap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/trap.c b/src/trap.c index 8df8cb44d..20193d5fe 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3044,8 +3044,9 @@ blow_up_landmine(struct trap *trap) /* if under the portcullis, the bridge is adjacent */ if (find_drawbridge(&dbx, &dby)) destroy_drawbridge(dbx, dby); - trap = t_at(x, y); /* expected to be null after destruction */ } + trap = t_at(x, y); /* expected to be null after destruction */ + /* or could be null if scatter blew up oil which melted ice */ /* convert landmine into pit */ if (trap) { if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) {