Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-11-30 12:46:41 +0300
committerBastien Montagne <bastien@blender.org>2021-11-30 13:04:41 +0300
commit6f460b76fec18da63d5e7ed8f7ee94a08d0f4719 (patch)
treeb0163f7e2fad54968b04c33b3df850a1c178a85b /source/blender/blenkernel/intern/blendfile_link_append.c
parentbc1e3238c453a91a34d280031af18b1601cd94b0 (diff)
LibLink/Append: tweak asserts in main BKE link/append functions.
Now that those functions are much widely used, just return early in case there is nothing to link/append, instead of asserting over it.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile_link_append.c')
-rw-r--r--source/blender/blenkernel/intern/blendfile_link_append.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/blendfile_link_append.c b/source/blender/blenkernel/intern/blendfile_link_append.c
index 17c44bbd5f5..933083efe40 100644
--- a/source/blender/blenkernel/intern/blendfile_link_append.c
+++ b/source/blender/blenkernel/intern/blendfile_link_append.c
@@ -914,6 +914,11 @@ static int foreach_libblock_link_append_callback(LibraryIDLinkCallbackData *cb_d
* Then we can heavily simplify #BKE_library_make_local(). */
void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *reports)
{
+ if (lapp_context->num_items == 0) {
+ /* Nothing to append. */
+ return;
+ }
+
Main *bmain = lapp_context->params->bmain;
BLI_assert((lapp_context->params->flag & FILE_LINK) == 0);
@@ -1183,14 +1188,19 @@ void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *
void BKE_blendfile_link(BlendfileLinkAppendContext *lapp_context, ReportList *reports)
{
+ if (lapp_context->num_items == 0) {
+ /* Nothing to be linked. */
+ return;
+ }
+
+ BLI_assert(lapp_context->num_libraries != 0);
+
Main *mainl;
Library *lib;
LinkNode *liblink, *itemlink;
int lib_idx, item_idx;
- BLI_assert(lapp_context->num_items && lapp_context->num_libraries);
-
for (lib_idx = 0, liblink = lapp_context->libraries.list; liblink;
lib_idx++, liblink = liblink->next) {
BlendfileLinkAppendContextLibrary *lib_context = liblink->link;