From 34a758c7f68057f66898a4c49d43c6069ff3d1a5 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 22 Jan 2014 21:27:25 -0500 Subject: bugfix: Don't crash if HOME is not set diff --git a/src/PlatformUtils-posix.cc b/src/PlatformUtils-posix.cc index d7b7b6d..d2b8792 100644 --- a/src/PlatformUtils-posix.cc +++ b/src/PlatformUtils-posix.cc @@ -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 ""; + } } -- cgit v0.10.1