Merge pull request #1650 from leo-arch/master

Fix crash when PWD is set to empty string
This commit is contained in:
Arun 2023-05-19 01:57:34 +05:30 committed by GitHub
commit 04d9f6738d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -8713,7 +8713,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 */