From: PatR Date: Thu, 4 Feb 2021 01:09:35 +0000 (-0800) Subject: prevent lua crash upon init failure X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52ae2b9df3717ae3c9028d19853ca1f366195904;p=nethack prevent lua crash upon init failure panic() instead, so not much help to the player. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 432235692..76d9b7e2f 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/dungeon.c b/src/dungeon.c index f789d266a..f70dcf6bf 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -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);