]> git.mxchange.org Git - simgear.git/commitdiff
#599: Don't crash when a path does not exist.
authorThorstenB <brehmt@gmail.com>
Fri, 13 Jan 2012 18:58:45 +0000 (19:58 +0100)
committerThorstenB <brehmt@gmail.com>
Fri, 13 Jan 2012 18:58:45 +0000 (19:58 +0100)
simgear/misc/sg_path.cxx

index e4b3cbf963500744fbed8994bef83f1b3f3458a4..d51c93afdf74c791746a33883a878db061a1c2a4 100644 (file)
@@ -490,6 +490,11 @@ std::string SGPath::realpath() const
     return path;
 #else
     char* buf = ::realpath(path.c_str(), NULL);
+    if (!buf)
+    {
+        SG_LOG(SG_IO, SG_ALERT, "ERROR: The path '" << path << "' does not exist in the file system.");
+        return path;
+    }
     std::string p(buf);
     free(buf);
     return p;