mirror of
https://github.com/jarun/nnn.git
synced 2025-01-15 13:26:37 +00:00
Fix crash when PWD is set to empty string
nnn crashes when PWD is set to empty string: `PWD="" nnn`
This commit is contained in:
parent
aaf60b93d7
commit
4babedc3e4
|
@ -8716,7 +8716,7 @@ int main(int argc, char *argv[])
|
|||
/* Start in the current directory */
|
||||
char *startpath = getenv("PWD");
|
||||
|
||||
initpath = startpath ? xstrdup(startpath) : getcwd(NULL, 0);
|
||||
initpath = (startpath && *startpath) ? xstrdup(startpath) : getcwd(NULL, 0);
|
||||
if (!initpath)
|
||||
initpath = "/";
|
||||
} else { /* Open a file */
|
||||
|
|
Loading…
Reference in a new issue