We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 228e82e commit 43a48c6Copy full SHA for 43a48c6
1 file changed
libraries/Runtime/BridJ/src/main/velocity/org/bridj/Pointer.java
@@ -547,15 +547,16 @@ public long getValidElements() {
547
*/
548
public ListIterator<T> iterator() {
549
return new ListIterator<T>() {
550
- Pointer<T> next = Pointer.this.getValidElements() > 0 ? Pointer.this : null;
+ Pointer<T> next = Pointer.this.getValidElements() != 0 ? Pointer.this : null;
551
Pointer<T> previous;
552
@Override
553
public T next() {
554
if (next == null)
555
throw new NoSuchElementException();
556
T value = next.get();
557
previous = next;
558
- next = next.getValidElements() > 1 ? next.next(1) : null;
+ long valid = next.getValidElements();
559
+ next = valid < 0 || valid > 1 ? next.next(1) : null;
560
return value;
561
}
562
0 commit comments