Only throw an expection if buf == NULL..
This commit is contained in:
parent
dc1696dfd5
commit
c722f90848
@ -92,8 +92,10 @@ Dir Dir::current()
|
|||||||
#else
|
#else
|
||||||
char *buf = ::getcwd(NULL, 0);
|
char *buf = ::getcwd(NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
if (!buf && errno == 2) sg_exception("The current directory is invalid");
|
if (!buf) {
|
||||||
|
if (errno == 2) sg_exception("The current directory is invalid");
|
||||||
else throw sg_exception(strerror(errno));
|
else throw sg_exception(strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
SGPath p(buf);
|
SGPath p(buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user