diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-10-13 12:43:32 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-10-13 15:37:17 +0300 |
commit | 16289274ed6fdae83a3fbe400698d5d40c7a5d6c (patch) | |
tree | 67ee502799dcabf869b02231e70bfd77c0b24f1b /source/blender/windowmanager | |
parent | 79875e37fe281c1988a1160978ab904bd42a336a (diff) |
Fix T81656: Crash relocating a linked library into the current .blend
A .blend file cannot use itself as a library.
This is prevented when linking manually, but was still possible when
relocating, which is now prevented.
Maniphest Tasks: T81656
Differential Revision: https://developer.blender.org/D9191
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files_link.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 860c1d40dd9..e97f4ed0fa6 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -1057,6 +1057,15 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload) return OPERATOR_CANCELLED; } + if (BLI_path_cmp(BKE_main_blendfile_path(bmain), path) == 0) { + BKE_reportf(op->reports, + RPT_ERROR_INVALID_INPUT, + "Cannot relocate library '%s' to current blend file '%s'", + lib->id.name, + path); + return OPERATOR_CANCELLED; + } + if (BLI_path_cmp(lib->filepath_abs, path) == 0) { #ifdef PRINT_DEBUG printf("We are supposed to reload '%s' lib (%d)...\n", lib->filepath, lib->id.us); |