]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fread_file_name) [DOS_NT]: Don't crash if homedir is NULL.
authorEli Zaretskii <eliz@gnu.org>
Sat, 2 Dec 2000 11:16:13 +0000 (11:16 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 2 Dec 2000 11:16:13 +0000 (11:16 +0000)
src/fileio.c

index ce8172df03d4902f5b820ebc4a713c0aec2094a4..3385da52da03a989153c901c3f3ec83924c05fcf 100644 (file)
@@ -5627,8 +5627,13 @@ provides a file dialog box..")
   /* If dir starts with user's homedir, change that to ~. */
   homedir = (char *) egetenv ("HOME");
 #ifdef DOS_NT
-  homedir = strcpy (alloca (strlen (homedir) + 1), homedir);
-  CORRECT_DIR_SEPS (homedir);
+  /* homedir can be NULL in temacs, since Vprocess_environment is not
+     yet set up.  We shouldn't crash in that case.  */
+  if (homedir != 0)
+    {
+      homedir = strcpy (alloca (strlen (homedir) + 1), homedir);
+      CORRECT_DIR_SEPS (homedir);
+    }
 #endif
   if (homedir != 0
       && STRINGP (dir)