From 21f2e1f25017612959a81bccf4096e36b0c57e10 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Fri, 13 Jan 2012 19:58:45 +0100 Subject: [PATCH] #599: Don't crash when a path does not exist. --- simgear/misc/sg_path.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index e4b3cbf9..d51c93af 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -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;