diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java index f43f0a41b8d5..86c3a1529fe3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java @@ -130,7 +130,11 @@ public boolean hasNext() { */ @Override public ENTITY_TYPE next() { - return this.currentSegmentIterator.next(); + if(hasNext()) { + return this.currentSegmentIterator.next(); + } else { + throw new NoSuchElementException(); + } } /**