diff options
author | Rex Kerr <ichoran@gmail.com> | 2014-11-21 15:22:04 -0800 |
---|---|---|
committer | Rex Kerr <ichoran@gmail.com> | 2014-11-21 15:22:04 -0800 |
commit | 20cafc969d1ebc4f2497645b9f1d11b9074bc217 (patch) | |
tree | 0145bb230293845d6af639b43653a03fbf2ce02e /src | |
parent | c4df20d29a8d15ef23cf0d10fad56da0791bbbf6 (diff) | |
download | scala-20cafc969d1ebc4f2497645b9f1d11b9074bc217.tar.gz scala-20cafc969d1ebc4f2497645b9f1d11b9074bc217.tar.bz2 scala-20cafc969d1ebc4f2497645b9f1d11b9074bc217.zip |
SI-8951 SeqView and StreamView stack-overflow on negative index after flatMap
Checks and throws IndexOutOfBounds now.
No test, caught and checked by scala-collections-laws (line 405 presently).
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/collection/SeqViewLike.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/library/scala/collection/SeqViewLike.scala b/src/library/scala/collection/SeqViewLike.scala index e719f19c78..ef6d2272cb 100644 --- a/src/library/scala/collection/SeqViewLike.scala +++ b/src/library/scala/collection/SeqViewLike.scala @@ -83,6 +83,7 @@ trait SeqViewLike[+A, } def length = index(self.length) def apply(idx: Int) = { + if (idx < 0 || idx >= self.length) throw new IndexOutOfBoundsException(idx.toString) val row = findRow(idx, 0, self.length - 1) mapping(self(row)).seq.toSeq(idx - index(row)) } |