summaryrefslogtreecommitdiffhomepage
path: root/gui/main.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-22 15:50:03 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-22 15:50:03 +0100
commit007f8c41475ddbad34f29593bf0b744ebbca4a2a (patch)
treeaa6a91410a298c2b60866d6743f150f8928844a1 /gui/main.cpp
parentfd4365c87172212f944587cd74bbc8e409bade5c (diff)
[COVERITY] gui/main: fix implausible null pointer dereference
Guard against NULL in the improbable case there's no PATH variable in the process' environment.
Diffstat (limited to 'gui/main.cpp')
-rw-r--r--gui/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/gui/main.cpp b/gui/main.cpp
index 4b3e1f14..0ba62ee8 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -72,9 +72,12 @@ void add_win32_path()
for (const char* ptr : contents)
{
+ if (ptr == nullptr)
+ continue;
+
strcat_s(env_path, sizeof(env_path), ptr);
- if (ptr == nullptr || ptr[0] == '\0' || env_path[0] == '\0')
+ if (ptr[0] == '\0' || env_path[0] == '\0')
{
qDebug() << "bad path element, debug info:"
<< (ptr == nullptr ? "<null>" : ptr)