Fix infinite loop

This commit is contained in:
Marc Baloup 2021-08-23 03:55:06 +02:00
parent cbdf37800a
commit 2c933529f1
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893

View File

@ -41,13 +41,11 @@ public class IteratorIterator<T> implements Iterator<T> {
} }
private void fixState() { private void fixState() {
fixCurrentIterator(); fixCurrentIterator();
while (currentIterator == null) { while (currentIterator == null && iterators.hasNext()) {
if (iterators.hasNext()) {
currentIterator = iterators.next(); currentIterator = iterators.next();
fixCurrentIterator(); fixCurrentIterator();
} }
} }
}
@Override @Override
public boolean hasNext() { public boolean hasNext() {