prevent lua crash upon init failure

panic() instead, so not much help to the player.
This commit is contained in:
PatR
2021-02-03 17:09:35 -08:00
parent 14cb015d72
commit 52ae2b9df3
2 changed files with 7 additions and 2 deletions
+2 -1
View 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 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 not scrolls or wands) and every item was actually discovered
change to can_reach_floor() resulted in hero being unable to reach the floor change to can_reach_floor() resulted in hero being unable to reach the floor
when held by a lichen when held by a lichen
panic if lua init fails
curses: 'msg_window' option wasn't functional for curses unless the binary curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support also included tty support
+5 -1
View 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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -753,6 +753,10 @@ init_dungeons(void)
pd.n_levs = pd.n_brs = 0; pd.n_levs = pd.n_brs = 0;
L = nhl_init(); L = nhl_init();
if (!L) {
panic1("'nhl_init' failed; can't continue.");
/*NOTREACHED*/
}
if (!nhl_loadlua(L, DUNGEON_FILE)) { if (!nhl_loadlua(L, DUNGEON_FILE)) {
char tbuf[BUFSZ]; char tbuf[BUFSZ];
Sprintf(tbuf, "Cannot open dungeon description - \"%s", DUNGEON_FILE); Sprintf(tbuf, "Cannot open dungeon description - \"%s", DUNGEON_FILE);