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