Fix the PriorityQueue.Iterator.foreach
authorMaciej Piechotka <uzytkownik2@gmail.com>
Mon, 15 Jul 2013 17:36:51 +0000 (19:36 +0200)
committerMaciej Piechotka <uzytkownik2@gmail.com>
Mon, 15 Jul 2013 17:36:51 +0000 (19:36 +0200)
gee/priorityqueue.vala

index d0c5d6b..d6f6abe 100644 (file)
@@ -1188,15 +1188,18 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> {
                        stamp++;
                        assert (stamp == queue._stamp);
                }
-               
+
                public bool read_only { get { return false; } }
-               
+
                public bool valid { get { return position != null; } }
 
                public bool foreach (ForallFunc<G> f) {
                        if (position == null) {
                                position = (previous != null) ? previous.iter_next : queue._iter_head;
                        }
+                       if (position == null) {
+                               return true;
+                       }
                        if (!f (position.data)) {
                                return false;
                        }