From 67832e4740f454a60676ab5429674458676df83a 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); -- 2.39.5