From 93b66ff8daae6de46438672464e6b35b021452ae Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 23 Jul 2021 21:09:35 +0300 Subject: [PATCH] Prevent segfault on nonexistent mapseen Cannot happen on normal play, but with some lua trickery ... --- src/dungeon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dungeon.c b/src/dungeon.c index 5f851a0a7..9bf9343e6 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -3000,6 +3000,8 @@ mapseen_temple(struct monst *priest UNUSED) /* currently unused; { mapseen *mptr = find_mapseen(&u.uz); + if (!mptr) + return; if (Is_valley(&u.uz)) mptr->flags.valley = 1; else if (Is_sanctum(&u.uz)) @@ -3012,7 +3014,8 @@ room_discovered(int roomno) { mapseen *mptr = find_mapseen(&u.uz); - mptr->msrooms[roomno].seen = 1; + if (mptr) + mptr->msrooms[roomno].seen = 1; } /* #overview command */