mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
* (bug #5709) Fix crash when invoked with --version
This commit is contained in:
parent
79bb668a9f
commit
37f2b4db90
2 changed files with 14 additions and 3 deletions
|
@ -140,7 +140,12 @@ Sys_PIDFileName
|
|||
*/
|
||||
static char *Sys_PIDFileName( void )
|
||||
{
|
||||
return va( "%s/%s", Sys_DefaultHomePath( ), PID_FILENAME );
|
||||
const char *homePath = Sys_DefaultHomePath( );
|
||||
|
||||
if( *homePath != NULL )
|
||||
return va( "%s/%s", Sys_DefaultHomePath( ), PID_FILENAME );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -156,6 +161,9 @@ qboolean Sys_WritePIDFile( void )
|
|||
FILE *f;
|
||||
qboolean stale = qfalse;
|
||||
|
||||
if( pidFile == NULL )
|
||||
return qfalse;
|
||||
|
||||
// First, check if the pid file is already there
|
||||
if( ( f = fopen( pidFile, "r" ) ) != NULL )
|
||||
{
|
||||
|
@ -204,7 +212,10 @@ static __attribute__ ((noreturn)) void Sys_Exit( int exitCode )
|
|||
if( exitCode < 2 )
|
||||
{
|
||||
// Normal exit
|
||||
remove( Sys_PIDFileName( ) );
|
||||
char *pidFile = Sys_PIDFileName( );
|
||||
|
||||
if( pidFile != NULL )
|
||||
remove( pidFile );
|
||||
}
|
||||
|
||||
Sys_PlatformExit( );
|
||||
|
|
|
@ -53,7 +53,7 @@ char *Sys_DefaultHomePath(void)
|
|||
{
|
||||
char *p;
|
||||
|
||||
if( !*homePath )
|
||||
if( !*homePath && com_homepath != NULL )
|
||||
{
|
||||
if( ( p = getenv( "HOME" ) ) != NULL )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue