Browse Source

engine: fix NULL ptr dereference when log file cannot be opened

pull/2/head
Alibek Omarov 3 years ago
parent
commit
61643585e0
  1. 9
      engine/common/sys_con.c

9
engine/common/sys_con.c

@ -113,12 +113,17 @@ void Sys_InitLog( void )
if( s_ld.log_active ) if( s_ld.log_active )
{ {
s_ld.logfile = fopen( s_ld.log_path, mode ); s_ld.logfile = fopen( s_ld.log_path, mode );
if( !s_ld.logfile ) Con_Reportf( S_ERROR "Sys_InitLog: can't create log file %s\n", s_ld.log_path ); if( !s_ld.logfile )
{
Con_Reportf( S_ERROR "Sys_InitLog: can't create log file %s\n", s_ld.log_path );
}
else
{
fprintf( s_ld.logfile, "=================================================================================\n" ); fprintf( s_ld.logfile, "=================================================================================\n" );
fprintf( s_ld.logfile, "\t%s (build %i) started at %s\n", s_ld.title, Q_buildnum(), Q_timestamp( TIME_FULL )); fprintf( s_ld.logfile, "\t%s (build %i) started at %s\n", s_ld.title, Q_buildnum(), Q_timestamp( TIME_FULL ));
fprintf( s_ld.logfile, "=================================================================================\n" ); fprintf( s_ld.logfile, "=================================================================================\n" );
} }
}
} }
void Sys_CloseLog( void ) void Sys_CloseLog( void )

Loading…
Cancel
Save