Selaa lähdekoodia

fix array iterator != and == operators for empty arrays

Kolja Strohm 3 viikkoa sitten
vanhempi
commit
81603f7988
1 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 6 2
      Array.h

+ 6 - 2
Array.h

@@ -243,12 +243,16 @@ namespace Framework
 
         bool operator!=(ArrayIterator<TYP>& r)
         {
-            return current != r.current;
+            return current != r.current
+                || ((!current || !current->set)
+                    && (!r.current || !r.current->set));
         }
 
         bool operator==(ArrayIterator<TYP>& r)
         {
-            return current == r.current;
+            return current == r.current
+                || ((!current || !current->set)
+                    && (!r.current || !r.current->set));
         }
 
         void remove() override