bugfix: Don't crash if HOME is not set

export-menu
Marius Kintel 2014-01-22 21:27:25 -05:00
parent 556040439e
commit 34a758c7f6
1 changed files with 9 additions and 4 deletions

View File

@ -3,8 +3,13 @@
std::string PlatformUtils::documentsPath()
{
fs::path docpath(getenv("HOME"));
docpath = docpath / ".local" / "share";
return boosty::stringy(docpath);
const char *home = getenv("HOME");
if (home) {
fs::path docpath(home);
docpath = docpath / ".local" / "share";
return boosty::stringy(docpath);
}
else {
return "";
}
}