]> granicus.if.org Git - nethack/commitdiff
Prevent segfault trying to make non-existent trap seen
authorPasi Kallinen <paxed@alt.org>
Tue, 1 Mar 2022 13:31:22 +0000 (15:31 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 1 Mar 2022 13:31:22 +0000 (15:31 +0200)
src/mklev.c

index 1471013ffb754e81b14a9dcca6af68b9d5fe5a04..3e387bd9614d8a6dff72804fe187fff16ae360ab 100644 (file)
@@ -1468,7 +1468,7 @@ mktrap(int num, int mktrapflags, struct mkroom *croom, coord *tm)
 
     if (kind == WEB && !(mktrapflags & MKTRAP_NOSPIDERONWEB))
         (void) makemon(&mons[PM_GIANT_SPIDER], m.x, m.y, NO_MM_FLAGS);
-    if ((mktrapflags & MKTRAP_SEEN))
+    if (t && (mktrapflags & MKTRAP_SEEN))
         t->tseen = TRUE;
 
     /* The hero isn't the only person who's entered the dungeon in