From df1ba83a53d363cbd98a135d62cd778f7f9955d0 Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Tue, 14 May 2019 00:46:53 +0200 Subject: [PATCH] check if tmp is null --- src/util/Misc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Misc.h b/src/util/Misc.h index 6cd667d..6bac94b 100644 --- a/src/util/Misc.h +++ b/src/util/Misc.h @@ -119,7 +119,7 @@ inline std::string getHomeDir() { inline std::string getTmpDir() { // first, check if an env variable is set const char* tmpdir = getenv("TMPDIR"); - if (std::strlen(tmpdir)) return std::string(tmpdir); + if (tmpdir && std::strlen(tmpdir)) return std::string(tmpdir); // second, check if /tmp is writable if (access("/tmp/", W_OK) == 0) return "/tmp";