Only throw an expection if buf == NULL..
This commit is contained in:
parent
dc1696dfd5
commit
c722f90848
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user