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

This commit is contained in:
Bastien Montagne 2018-02-07 22:09:44 +01:00
parent 843271d0a5
commit 49745aa5ff
1 changed files with 7 additions and 2 deletions

View File

@ -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); */