aboutsummaryrefslogtreecommitdiff
path: root/src/path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/path.cc')
-rw-r--r--src/path.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/path.cc b/src/path.cc
index 1d14528..3ab8c0c 100644
--- a/src/path.cc
+++ b/src/path.cc
@@ -31,7 +31,8 @@ string path_unifier(const string &s, bool is_cmd)
// single word, use path
if (is_cmd && (s.find("/") == string::npos))
{
- string path = getenv("PATH");
+ const char *path_p = getenv("PATH");
+ string path = (path_p != nullptr) ? path_p : "";
size_t i = 0, j = 0, l = path.size();
while (true)
{