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.
This commit is contained in:
Pasi Kallinen
2024-05-31 10:28:41 +03:00
parent 0490f7736c
commit 2ba42cf78c

View File

@@ -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)) {