]> granicus.if.org Git - nethack/commitdiff
prevent lua crash upon init failure
authorPatR <rankin@nethack.org>
Thu, 4 Feb 2021 01:09:35 +0000 (17:09 -0800)
committerPatR <rankin@nethack.org>
Thu, 4 Feb 2021 01:09:35 +0000 (17:09 -0800)
panic() instead, so not much help to the player.

doc/fixes37.0
src/dungeon.c

index 432235692206b8f91aab163936c2020b2a711cd9..76d9b7e2fd0624ce61cf29001eb6f70f82696da0 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.439 $ $NHDT-Date: 1612055953 2021/01/31 01:19:13 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.443 $ $NHDT-Date: 1612400970 2021/02/04 01:09:30 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -503,6 +503,7 @@ changes accompanying sorting of discoveries resulted in omitting very last
        not scrolls or wands) and every item was actually discovered
 change to can_reach_floor() resulted in hero being unable to reach the floor
        when held by a lichen
+panic if lua init fails
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index f789d266a0d4eb4f96661c87d477017df8d838f2..f70dcf6bf5222eec4a5fc9e7533efd975c6daa35 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 dungeon.c       $NHDT-Date: 1605305480 2020/11/13 22:11:20 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.138 $ */
+/* NetHack 3.7 dungeon.c       $NHDT-Date: 1612400967 2021/02/04 01:09:27 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.146 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -753,6 +753,10 @@ init_dungeons(void)
     pd.n_levs = pd.n_brs = 0;
 
     L = nhl_init();
+    if (!L) {
+        panic1("'nhl_init' failed; can't continue.");
+        /*NOTREACHED*/
+    }
     if (!nhl_loadlua(L, DUNGEON_FILE)) {
         char tbuf[BUFSZ];
         Sprintf(tbuf, "Cannot open dungeon description - \"%s", DUNGEON_FILE);