]> git.mxchange.org Git - simgear.git/commitdiff
Only throw an expection if buf == NULL..
authorErik Hofman <erik@ehofman.com>
Tue, 7 Jun 2016 10:59:16 +0000 (12:59 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
simgear/misc/sg_dir.cxx

index ce69b4ac68f731cf0ec5a24e6fc38b0db95695d5..34d25f9ef6df58cdd6e05c5c58a88192feff68ed 100644 (file)
@@ -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);