[Bf-blender-cvs] [49745aa5ff6] master: Library linking code: proper early out in case there is nothing to link.

Bastien Montagne noreply at git.blender.org
Wed Feb 7 22:17:10 CET 2018


Commit: 49745aa5ff63d054d36b3384ecb37835307e149c
Author: Bastien Montagne
Date:   Wed Feb 7 22:09:44 2018 +0100
Branches: master
https://developer.blender.org/rB49745aa5ff63d054d36b3384ecb37835307e149c

Library linking code: proper early out in case there is nothing to link.

===================================================================

M	source/blender/windowmanager/intern/wm_files_link.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index dca1077ebc7..171863454d9 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -282,7 +282,6 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 	char path[FILE_MAX_LIBEXTRA], root[FILE_MAXDIR], libname[FILE_MAX_LIBEXTRA], relname[FILE_MAX];
 	char *group, *name;
 	int totfiles = 0;
-	short flag;
 
 	RNA_string_get(op->ptr, "filename", relname);
 	RNA_string_get(op->ptr, "directory", root);
@@ -319,7 +318,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
-	flag = wm_link_append_flag(op);
+	short flag = wm_link_append_flag(op);
 
 	/* sanity checks for flag */
 	if (scene && scene->id.lib) {
@@ -401,6 +400,12 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 		BLI_BITMAP_ENABLE(item->libraries, 0);
 	}
 
+	if (lapp_data->num_items == 0) {
+		/* Early out in case there is nothing to link. */
+		wm_link_append_data_free(lapp_data);
+		return;
+	}
+
 	/* XXX We'd need re-entrant locking on Main for this to work... */
 	/* BKE_main_lock(bmain); */



More information about the Bf-blender-cvs mailing list