mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Avoid hard crashes when calling love.filesystem functions if love.filesystem.init was never called.
This only applies when liblove is used directly, as love.filesystem.init is called automatically when the love executable starts up.
This commit is contained in:
@@ -57,6 +57,9 @@ bool File::open(Mode mode)
|
||||
if (mode == MODE_CLOSED)
|
||||
return true;
|
||||
|
||||
if (!PHYSFS_isInit())
|
||||
throw love::Exception("PhysFS is not initialized.");
|
||||
|
||||
// File must exist if read mode.
|
||||
if ((mode == MODE_READ) && !PHYSFS_exists(filename.c_str()))
|
||||
throw love::Exception("Could not open file %s. Does not exist.", filename.c_str());
|
||||
|
||||
Reference in New Issue
Block a user