]> granicus.if.org Git - nethack/commitdiff
Prevent segfault on nonexistent mapseen
authorPasi Kallinen <paxed@alt.org>
Fri, 23 Jul 2021 18:09:35 +0000 (21:09 +0300)
committerPasi Kallinen <paxed@alt.org>
Fri, 23 Jul 2021 18:09:39 +0000 (21:09 +0300)
Cannot happen on normal play, but with some lua trickery ...

src/dungeon.c

index 5f851a0a7b7de39d6e4fe467b854de0af7614cd6..9bf9343e6c15890705f5f19f328ed120c0e3cc49 100644 (file)
@@ -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 */