]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
host: Gracefully Sys_Error if we encounter any error during init
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2020 16:09:19 +0000 (16:09 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2020 16:09:19 +0000 (16:09 +0000)
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
menu.c

diff --git a/host.c b/host.c
index 65c22bc856d48fe9b7beca1dcb60946890cac924..af9a7b806295f5017e0bca2599862d65e1fcbb1e 100644 (file)
--- a/host.c
+++ b/host.c
@@ -616,6 +616,9 @@ static void Host_Init (void)
 
        host.state = host_init;
 
 
        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);
 
        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
        // 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);
 
 
        Host_AddConfigText(cmd);
 
diff --git a/menu.c b/menu.c
index 481be8784393b9455046bf412bfb0ae8e816b2a2..fcea8dc487c643b06334c9283eab90b5c99ca6ab 100644 (file)
--- 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);
        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 ) {
        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
        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)
 }
 
 static void MVM_begin_increase_edicts(prvm_prog_t *prog)