[Bf-blender-cvs] [8c37c378a43] functions: more assertions in ArrayLookup

Jacques Lucke noreply at git.blender.org
Wed May 22 17:32:45 CEST 2019


Commit: 8c37c378a432332bb364e914d5d46d63de6374c2
Author: Jacques Lucke
Date:   Wed May 22 17:21:12 2019 +0200
Branches: functions
https://developer.blender.org/rB8c37c378a432332bb364e914d5d46d63de6374c2

more assertions in ArrayLookup

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

M	source/blender/blenlib/BLI_array_lookup.hpp

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

diff --git a/source/blender/blenlib/BLI_array_lookup.hpp b/source/blender/blenlib/BLI_array_lookup.hpp
index 7f3ca3afcc1..b7421ac119d 100644
--- a/source/blender/blenlib/BLI_array_lookup.hpp
+++ b/source/blender/blenlib/BLI_array_lookup.hpp
@@ -130,6 +130,7 @@ class ArrayLookup {
   void update_index(const Key &key, Index old_index, Index new_index)
   {
     ITER_SLOTS (key, slot, state) {
+      BLI_assert(state != SLOT_EMPTY);
       if (state == old_index) {
         m_map[slot] = new_index;
         break;
@@ -155,6 +156,7 @@ class ArrayLookup {
   void remove(const Key &key, Index index)
   {
     ITER_SLOTS (key, slot, state) {
+      BLI_assert(state != SLOT_EMPTY);
       if (state == index) {
         m_map[slot] = SLOT_DUMMY;
         m_length--;
@@ -223,6 +225,7 @@ class ArrayLookup {
   inline void insert_index_for_key__no_dummy(const Key &key, Index index)
   {
     ITER_SLOTS (key, slot, state) {
+      BLI_assert(state != SLOT_DUMMY);
       if (state == SLOT_EMPTY) {
         m_map[slot] = index;
         break;



More information about the Bf-blender-cvs mailing list