From: Pasi Kallinen Date: Sat, 31 Oct 2015 23:44:10 +0000 (+0200) Subject: Prevent array underflow X-Git-Tag: NetHack-3.6.0_RC01~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b44486e7cc185eb6f967b8b3f17fe30e1934dce7;p=nethack Prevent array underflow --- diff --git a/src/sounds.c b/src/sounds.c index e73890a92..5c0107f50 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -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