engine: filesystem: do not crash if engine was shutdown before filesystem was loaded

This commit is contained in:
Alibek Omarov 2023-04-28 04:40:44 +03:00
parent 3e2a215c15
commit 5162ab62fd

View file

@ -54,10 +54,13 @@ static fs_interface_t fs_memfuncs =
}; };
static void FS_UnloadProgs( void ) static void FS_UnloadProgs( void )
{
if( fs_hInstance )
{ {
COM_FreeLibrary( fs_hInstance ); COM_FreeLibrary( fs_hInstance );
fs_hInstance = 0; fs_hInstance = 0;
} }
}
#ifdef XASH_INTERNAL_GAMELIBS #ifdef XASH_INTERNAL_GAMELIBS
#define FILESYSTEM_STDIO_DLL "filesystem_stdio" #define FILESYSTEM_STDIO_DLL "filesystem_stdio"
@ -133,9 +136,8 @@ FS_Shutdown
*/ */
void FS_Shutdown( void ) void FS_Shutdown( void )
{ {
int i; if( g_fsapi.ShutdownStdio )
g_fsapi.ShutdownStdio();
FS_ShutdownStdio();
memset( &SI, 0, sizeof( sysinfo_t )); memset( &SI, 0, sizeof( sysinfo_t ));