1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01: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

@ -133,9 +133,12 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
} }
void FILESYSTEM_deinit() void FILESYSTEM_deinit()
{
if (PHYSFS_isInit())
{ {
PHYSFS_deinit(); PHYSFS_deinit();
} }
}
char *FILESYSTEM_getUserSaveDirectory() char *FILESYSTEM_getUserSaveDirectory()
{ {