]> granicus.if.org Git - nethack/commitdiff
Prevent array underflow
authorPasi Kallinen <paxed@alt.org>
Sat, 31 Oct 2015 23:44:10 +0000 (01:44 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 31 Oct 2015 23:44:10 +0000 (01:44 +0200)
src/sounds.c

index e73890a92c07cef592c7fd627ca28eb72367d1ad..5c0107f50d904473186f5711177aa29bc900a447 100644 (file)
@@ -16,8 +16,9 @@ struct monst *mon;
 int rmtyp;
 {
     int rno = levl[mon->mx][mon->my].roomno;
-
-    return rooms[rno - ROOMOFFSET].rtype == rmtyp;
+    if (rno >= ROOMOFFSET)
+        return rooms[rno - ROOMOFFSET].rtype == rmtyp;
+    return FALSE;
 }
 
 void