commit 04d9f6738d3c579340d72288c9f794d15453947c
parent e013a867dac2dd7b834c3c048062c33b2a08b236
Author: Arun <engineerarun@gmail.com>
Date: Fri, 19 May 2023 01:57:34 +0530
Merge pull request #1650 from leo-arch/master
Fix crash when PWD is set to empty string
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nnn.c b/src/nnn.c
@@ -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 */