Commit: c8a07ef66311a31cc45901717845139ae0682f2f
Author: Jacques Lucke
Date:   Thu Jul 14 11:32:01 2022 +0200
Branches: master
https://developer.blender.org/rBc8a07ef66311a31cc45901717845139ae0682f2f

BLI: fix finding indices from virtual array

The sorting of index vectors assumed that all vectors have
at least one element. Now this is checked for more explicitely.

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

M       source/blender/blenlib/intern/index_mask.cc

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

diff --git a/source/blender/blenlib/intern/index_mask.cc 
b/source/blender/blenlib/intern/index_mask.cc
index f3590e4a41c..e9af183d60d 100644
--- a/source/blender/blenlib/intern/index_mask.cc
+++ b/source/blender/blenlib/intern/index_mask.cc
@@ -142,6 +142,7 @@ IndexMask find_indices_based_on_predicate__merge(
   int64_t result_mask_size = 0;
   for (Vector<Vector<int64_t>> &local_sub_masks : sub_masks) {
     for (Vector<int64_t> &sub_mask : local_sub_masks) {
+      BLI_assert(!sub_mask.is_empty());
       all_vectors.append(&sub_mask);
       result_mask_size += sub_mask.size();
     }
@@ -232,7 +233,9 @@ IndexMask find_indices_from_virtual_array(const IndexMask 
indices_to_check,
             }
           }
         });
-        sub_masks.local().append(std::move(masked_indices));
+        if (!masked_indices.is_empty()) {
+          sub_masks.local().append(std::move(masked_indices));
+        }
       });
 
   return detail::find_indices_based_on_predicate__merge(indices_to_check, 
sub_masks, r_indices);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to