[Bf-blender-cvs] [6f460b76fec] master: LibLink/Append: tweak asserts in main BKE link/append functions.
Bastien Montagne
noreply at git.blender.org
Tue Nov 30 11:04:46 CET 2021
Commit: 6f460b76fec18da63d5e7ed8f7ee94a08d0f4719
Author: Bastien Montagne
Date: Tue Nov 30 10:46:41 2021 +0100
Branches: master
https://developer.blender.org/rB6f460b76fec18da63d5e7ed8f7ee94a08d0f4719
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.
===================================================================
M source/blender/blenkernel/intern/blendfile_link_append.c
===================================================================
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;
More information about the Bf-blender-cvs
mailing list