Skip to content

Commit 82a0ace

Browse files
committed
make Filesystem::getBaseDir fall back if df::global::init is missing
1 parent 76a1ce2 commit 82a0ace

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/modules/Filesystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ std::filesystem::path Filesystem::getInstallDir() noexcept
238238
std::filesystem::path Filesystem::getBaseDir() noexcept
239239
{
240240
auto getsavebase = []() {
241-
if (df::global::init->media.flag.is_set(df::enums::init_media_flags::PORTABLE_MODE))
241+
// assume portable mode is _on_ if init is missing
242+
if (!df::global::init || df::global::init->media.flag.is_set(df::enums::init_media_flags::PORTABLE_MODE))
242243
return DFSDL::DFSDL_GetBasePath();
243244
else
244245
return DFSDL::DFSDL_GetPrefPath("Bay 12 Games", "Dwarf Fortress");

0 commit comments

Comments
 (0)