aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/qcommon/common.c')
-rw-r--r--code/qcommon/common.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index 1c37c5e..5708146 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -181,11 +181,22 @@ void QDECL Com_Printf( const char *fmt, ... ) {
newtime = localtime( &aclock );
logfile = FS_FOpenFileWrite( "qconsole.log" );
- Com_Printf( "logfile opened on %s\n", asctime( newtime ) );
- if ( com_logfile->integer > 1 ) {
- // force it to not buffer so we get valid
- // data even if we are crashing
- FS_ForceFlush(logfile);
+
+ if(logfile)
+ {
+ Com_Printf( "logfile opened on %s\n", asctime( newtime ) );
+
+ if ( com_logfile->integer > 1 )
+ {
+ // force it to not buffer so we get valid
+ // data even if we are crashing
+ FS_ForceFlush(logfile);
+ }
+ }
+ else
+ {
+ Com_Printf("Opening qconsole.log failed!\n");
+ Cvar_SetValue("logfile", 0);
}
opening_qconsole = qfalse;