From f9db0ab8f90dc45a1abd29d14ef7b96ca80ca587 Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Tue, 1 Apr 2025 22:07:05 +0200 Subject: [PATCH] Fix an access violation that would occur when opening the logfile before com_version is created (#708) --- code/qcommon/common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/qcommon/common.c b/code/qcommon/common.c index e7dbd31c..03ae938c 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -274,10 +274,13 @@ void QDECL Com_Printf( const char *fmt, ... ) { logfile = FS_FOpenTextFileWrite( "qconsole.log" ); + // Remove recursive count as it won't be able to print relevant info + recursive_count--; if(logfile) { Com_Printf( "logfile opened on %s\n", asctime( newtime ) ); - Com_Printf( "=> game is version %s\n", com_version->string ); + Com_Printf( "=> game is version %s\n", PRODUCT_NAME PRODUCT_VERSION_FULL PLATFORM_STRING PRODUCT_VERSION_DATE ); + Com_Printf( "=> targeting game ID %d\n", Cvar_VariableIntegerValue( "com_target_game" ) ); if ( com_logfile->integer > 1 ) { @@ -291,6 +294,7 @@ void QDECL Com_Printf( const char *fmt, ... ) { Com_Printf("Opening qconsole.log failed!\n"); Cvar_SetValue("logfile", 0); } + recursive_count++; opening_qconsole = qfalse; }