diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-14 12:32:01 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-14 12:32:01 +0300 |
commit | c8a07ef66311a31cc45901717845139ae0682f2f (patch) | |
tree | 6f6009d2828497609544e7af6590fd6010d0452c /source/blender/blenlib | |
parent | bcdce4ffd848d5b47c467bedeb221645ec033f20 (diff) |
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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/index_mask.cc | 5 |
1 files changed, 4 insertions, 1 deletions
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); |