diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-11-01 05:09:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-11-01 05:11:48 +0300 |
commit | a0633e2484f21c9f80842c10b46b3af98b54d25a (patch) | |
tree | b19b840f0eb683a9cb371cc5b1f275056db05a03 /source/blender/editors/space_file/file_ops.c | |
parent | d4d38e8a34e59c8762034073b084ed3c5ee09af8 (diff) |
Fix crash when "HOME" environment variable isn't defined
Accessing the default directory in the file selector
would crash if HOME was undefined.
Add BKE_appdir_folder_default_or_root which never returns NULL.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index f647e1d4e4f..a83e1974baf 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -2463,12 +2463,14 @@ static void file_expand_directory(bContext *C) if (BLI_path_is_rel(params->dir)) { /* Use of 'default' folder here is just to avoid an error message on '//' prefix. */ BLI_path_abs(params->dir, - G.relbase_valid ? BKE_main_blendfile_path(bmain) : BKE_appdir_folder_default()); + G.relbase_valid ? BKE_main_blendfile_path(bmain) : + BKE_appdir_folder_default_or_root()); } else if (params->dir[0] == '~') { char tmpstr[sizeof(params->dir) - 1]; BLI_strncpy(tmpstr, params->dir + 1, sizeof(tmpstr)); - BLI_join_dirfile(params->dir, sizeof(params->dir), BKE_appdir_folder_default(), tmpstr); + BLI_path_join( + params->dir, sizeof(params->dir), BKE_appdir_folder_default_or_root(), tmpstr, NULL); } else if (params->dir[0] == '\0') |