From 417c884a1f07affbcd0bffe693ce354d032a337c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Dec 2000 11:16:13 +0000 Subject: [PATCH] (Fread_file_name) [DOS_NT]: Don't crash if homedir is NULL. --- src/fileio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index ce8172df03d..3385da52da0 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -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) -- 2.39.5