diff options
author | Richard Antalik <richardantalik@gmail.com> | 2019-11-03 06:29:59 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2019-11-03 06:57:11 +0300 |
commit | 8ab6ef30ab28e6c73fc9309c0b21ddbc1cd3afc9 (patch) | |
tree | 3f8a11294984abeb94406c1ba6fc3cc662a844db /source/blender/imbuf/intern | |
parent | 93f93e6b45581659b0622f47526d538bdbd6ef33 (diff) |
Fix T68018: Crash on building movie proxy
Skip building proxy if directory can not be created.
Crash happens, when setting custom dir to location of source file itself.
This results in attempt to create directory with the same name as source file.
Differential Revision: https://developer.blender.org/D6148
Reviewed By: sergey
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 97a0cc85301..46095b7eedc 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -366,7 +366,7 @@ void IMB_anim_get_fname(struct anim *anim, char *file, int size) BLI_strncpy(file, fname, size); } -static void get_proxy_filename(struct anim *anim, +static bool get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size, char *fname, bool temp) @@ -393,7 +393,12 @@ static void get_proxy_filename(struct anim *anim, get_index_dir(anim, index_dir, sizeof(index_dir)); + if (BLI_path_ncmp(anim->name, index_dir, FILE_MAXDIR) == 0) { + return false; + } + BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name); + return true; } static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char *fname) @@ -1154,8 +1159,9 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Proxy_Size proxy_size = proxy_sizes[i]; if (proxy_size & proxy_sizes_to_build) { char filename[FILE_MAX]; - get_proxy_filename(anim, proxy_size, filename, false); - + if (get_proxy_filename(anim, proxy_size, filename, false) == false) { + return NULL; + } void **filename_key_p; if (!BLI_gset_ensure_p_ex(file_list, filename, &filename_key_p)) { *filename_key_p = BLI_strdup(filename); @@ -1176,7 +1182,9 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Proxy_Size proxy_size = proxy_sizes[i]; if (proxy_size & built_proxies) { char filename[FILE_MAX]; - get_proxy_filename(anim, proxy_size, filename, false); + if (get_proxy_filename(anim, proxy_size, filename, false) == false) { + return NULL; + } printf("Skipping proxy: %s\n", filename); } } |