From 9ee6be87d7e3a561b3e6d9301a8551925b90fa13 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 16 May 2026 12:37:08 +0500 Subject: [PATCH] engine: host: try to avoid recursive Host_Error --- engine/common/host.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/engine/common/host.c b/engine/common/host.c index ebb7fe00..db35e9d7 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -700,29 +700,32 @@ void GAME_EXPORT Host_Error( const char *error, ... ) if( host.framecount < 3 ) { Sys_Error( "%sInit: %s", __func__, hosterror1 ); - } - else if( host.framecount == host.errorframe ) - { - Sys_Error( "%sMulti: %s", __func__, hosterror2 ); - } - else - { - Con_Printf( S_RED "%s" S_DEFAULT ": %s", __func__, hosterror1 ); - if( host_developer.value ) - { - UI_SetActiveMenu( false ); - Key_SetKeyDest( key_console ); - } - else Platform_MessageBox( "Host Error", hosterror1, true ); + return; } + if( host.framecount == host.errorframe ) + { + Sys_Error( "%sMulti: %s", __func__, hosterror2 ); + return; + } + + Con_Printf( S_RED "%s" S_DEFAULT ": %s", __func__, hosterror1 ); + if( host_developer.value ) + { + UI_SetActiveMenu( false ); + Key_SetKeyDest( key_console ); + } + else Platform_MessageBox( "Host Error", hosterror1, true ); + // host is shutting down. don't invoke infinite loop - if( host.status == HOST_SHUTDOWN ) return; + if( host.status == HOST_SHUTDOWN || host.status == HOST_ERR_FATAL ) + return; if( recursive ) { Con_Printf( S_RED "%sRecursive" S_DEFAULT ": %s", __func__, hosterror2 ); Sys_Error( "%s", hosterror1 ); + return; } recursive = true;