Only throw an expection if buf == NULL..

This commit is contained in:
Erik Hofman 2016-06-07 12:59:16 +02:00
parent dc1696dfd5
commit c722f90848

View 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);