summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/Iterator.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/library/scala/Iterator.scala b/src/library/scala/Iterator.scala
index 9d88a72626..4fff4c3faf 100644
--- a/src/library/scala/Iterator.scala
+++ b/src/library/scala/Iterator.scala
@@ -238,7 +238,7 @@ trait Iterator[+A] {
* @return the new iterator
*/
def drop(n: Int): Iterator[A] =
- if (n > 0) { next; drop(n - 1) } else this
+ if (n > 0 && hasNext) { next; drop(n - 1) } else this
/** Returns a new iterator that maps all elements of this iterator
* to new elements using function <code>f</code>.