From 34a758c7f68057f66898a4c49d43c6069ff3d1a5 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 22 Jan 2014 21:27:25 -0500 Subject: [PATCH 1/2] bugfix: Don't crash if HOME is not set --- src/PlatformUtils-posix.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/PlatformUtils-posix.cc b/src/PlatformUtils-posix.cc index d7b7b6d6..d2b87927 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 ""; + } } From b4fc711758d92e65819e534276ad77a7c4e5d69c Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 23 Jan 2014 19:54:52 -0500 Subject: [PATCH 2/2] compile fix: forgot include for boost::math::isinf --- src/primitives.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/primitives.cc b/src/primitives.cc index 97c1fef1..c9e1072b 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -40,6 +40,8 @@ #include #include using namespace boost::assign; // bring 'operator+=()' into scope + +#include using boost::math::isinf; #define F_MINIMUM 0.01