fix early crash during config file error processing

This commit is contained in:
nhmall
2018-05-21 16:39:16 -04:00
parent fcc26f2c44
commit d95dae3cf4
2 changed files with 23 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ permanent inventory window was updated too soon when a scroll of charging
for starting inventory, don't give an orc hero lembas wafers or cram rations
targetting with a polearm could give away location of hidden monster
static prototype could be left orphaned depending on #defines in rip.c
config file error handling routines were calling xx_wait_synch early
even before the window system was initialized; add a default routine
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 windows.c $NHDT-Date: 1495232365 2017/05/19 22:19:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.41 $ */
/* NetHack 3.6 windows.c $NHDT-Date: 1526933747 2018/05/21 20:15:47 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.48 $ */
/* Copyright (c) D. Cohrs, 1993. */
/* NetHack may be freely redistributed. See license for details. */
@@ -56,6 +56,7 @@ extern void *FDECL(trace_procs_chain, (int, int, void *, void *, void *));
#endif
STATIC_DCL void FDECL(def_raw_print, (const char *s));
STATIC_DCL void NDECL(def_wait_synch);
#ifdef DUMPLOG
STATIC_DCL winid FDECL(dump_create_nhwindow, (int));
@@ -191,6 +192,22 @@ const char *s;
puts(s);
}
STATIC_OVL
void
def_wait_synch(VOID_ARGS)
{
/* Config file error handling routines
* call wait_sync() without checking to
* see if it actually has a value,
* leading to spectacular violations
* when you try to execute address zero.
* The existence of this allows early
* processing to have something to execute
* even though it essentially does nothing
*/
return;
}
#ifdef WINCHAIN
static struct win_choices *
win_choices_find(s)
@@ -232,6 +249,9 @@ const char *s;
if (!windowprocs.win_raw_print)
windowprocs.win_raw_print = def_raw_print;
if (!windowprocs.win_wait_synch)
/* early config file error processing routines call this */
windowprocs.win_wait_synch = def_wait_synch;
if (!winchoices[0].procs) {
raw_printf("No window types?");