From c722f9084800c5516a220f9e2378969ac42804da Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Tue, 7 Jun 2016 12:59:16 +0200 Subject: [PATCH] Only throw an expection if buf == NULL.. --- simgear/misc/sg_dir.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/simgear/misc/sg_dir.cxx b/simgear/misc/sg_dir.cxx index ce69b4ac..34d25f9e 100644 --- a/simgear/misc/sg_dir.cxx +++ b/simgear/misc/sg_dir.cxx @@ -92,8 +92,10 @@ Dir Dir::current() #else char *buf = ::getcwd(NULL, 0); #endif - if (!buf && errno == 2) sg_exception("The current directory is invalid"); - else throw sg_exception(strerror(errno)); + if (!buf) { + if (errno == 2) sg_exception("The current directory is invalid"); + else throw sg_exception(strerror(errno)); + } SGPath p(buf); free(buf);