1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-28 23:48:30 +02:00

Guard PHYSFS_deinit() with PHYSFS_isInit()

A quick glance at PhysFS source code will show that PhysFS will bail if
PHYSFS_deinit() is called if it's not initialized.

"Bail" here just means setting an error code and returning early, so
it's not that bad. Still, it's the principle of the thing, and I just
want to ensure that FILESYSTEM_deinit() can be safely called no matter
if the filesystem hasn't initialized yet; having an error set by PhysFS
kind of taints the whole safety thing, even if it does nothing wrong,
no?

(although, speaking of which, we should be handling all errors by
PhysFS, but that's for later...)
This commit is contained in:
Misa 2021-02-15 18:03:52 -08:00 committed by Ethan Lee
parent 951e1653a6
commit 6077015fdc

View File

@ -134,7 +134,10 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
void FILESYSTEM_deinit()
{
PHYSFS_deinit();
if (PHYSFS_isInit())
{
PHYSFS_deinit();
}
}
char *FILESYSTEM_getUserSaveDirectory()