1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
From: Markus Koschany <apo@debian.org>
Date: Mon, 28 Apr 2014 22:55:19 +0200
Subject: mayhem segfault
Bug: https://bugs.debian.org/715632
Forwarded: no
---
src/UnixOptions.cxx | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/UnixOptions.cxx b/src/UnixOptions.cxx
index 0ffa7ac..7e85937 100644
--- a/src/UnixOptions.cxx
+++ b/src/UnixOptions.cxx
@@ -125,12 +125,16 @@ UnixOptions::getOptionsDirectory (void)
#if defined (IS_GP2X_HOST)
return std::string (".");
#else // IS_GP2X_HOST
- char *configHome = getenv ("XDG_CONFIG_HOME");
+ const char* configHome = getenv ("XDG_CONFIG_HOME");
std::string configDirectory (NULL == configHome ? "" : configHome);
if ( 0 == configDirectory.length () )
{
- configDirectory += getenv ("HOME");
- configDirectory += "/.config";
+ const char* configHome = getenv ("HOME");
+ if (configHome != NULL)
+ {
+ configDirectory += configHome;
+ configDirectory += "/.config";
+ }
}
configDirectory += "/amoebax";
makeDirectory (configDirectory);
|