From: Erik Hofman Date: Tue, 7 Jun 2016 10:59:16 +0000 (+0200) Subject: Only throw an expection if buf == NULL.. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=67832e4740f454a60676ab5429674458676df83a;p=simgear.git Only throw an expection if buf == NULL.. --- 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);