From 7faa0dba4d1f633b5cadf53ce734ed3776bc4d01 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Thu, 17 Sep 2020 16:09:19 +0000 Subject: [PATCH] host: Gracefully Sys_Error if we encounter any error during init The engine is left in an inconsistent state and it's not particularly safe to continue on. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12934 d7cf8633-e32d-0410-b094-e92efae38249 --- host.c | 6 +++--- menu.c | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/host.c b/host.c index 65c22bc8..af9a7b80 100644 --- a/host.c +++ b/host.c @@ -616,6 +616,9 @@ static void Host_Init (void) host.state = host_init; + if (setjmp(host.abortframe)) // Huh?! + Sys_Error("Engine initialization failed. Check the console (if available) for additional information.\n"); + if (Sys_CheckParm("-profilegameonly")) Sys_AllowProfiling(false); @@ -717,9 +720,6 @@ static void Host_Init (void) // without crashing the whole game, so this should just be a short-time solution // here comes the not so critical stuff - if (setjmp(host.abortframe)) { - return; - } Host_AddConfigText(cmd); diff --git a/menu.c b/menu.c index 481be878..fcea8dc4 100644 --- a/menu.c +++ b/menu.c @@ -5212,6 +5212,10 @@ void MVM_error_cmd(const char *format, ...) va_start (argptr, format); dpvsnprintf (errorstring, sizeof(errorstring), format, argptr); va_end (argptr); + + if (host.framecount < 3) + Sys_Error("Menu_Error: %s\n", errorstring); + Con_Printf( "Menu_Error: %s\n", errorstring ); if( !processingError ) { @@ -5236,8 +5240,7 @@ void MVM_error_cmd(const char *format, ...) R_SelectScene( RST_CLIENT ); // Let video start at least - if(host.state != host_init) - Host_AbortCurrentFrame(); + Host_AbortCurrentFrame(); } static void MVM_begin_increase_edicts(prvm_prog_t *prog) -- 2.39.2