diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-11-20 17:52:13 -0800 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-11-20 17:52:13 -0800 |
commit | 249b3c43a125542d1c981b32626fa77ae6f0d773 (patch) | |
tree | 9933817694e426a559de93983e63f91e6a5b906b /src/library | |
parent | 6cc33f09993c688283d5602d077a518f5b49e4d7 (diff) | |
parent | 2c23acf39e810fd43f9ce5af0a4c3e4d952f2081 (diff) | |
download | scala-249b3c43a125542d1c981b32626fa77ae6f0d773.tar.gz scala-249b3c43a125542d1c981b32626fa77ae6f0d773.tar.bz2 scala-249b3c43a125542d1c981b32626fa77ae6f0d773.zip |
Merge pull request #1597 from soc/SI-6634
SI-6634 Fixes data corruption issue in ListBuffer#remove
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/mutable/ListBuffer.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala index 53b2b57f50..4715b6818a 100644 --- a/src/library/scala/collection/mutable/ListBuffer.scala +++ b/src/library/scala/collection/mutable/ListBuffer.scala @@ -249,7 +249,12 @@ final class ListBuffer[A] * @param n the index which refers to the first element to remove. * @param count the number of elements to remove. */ + @annotation.migration("Invalid input values will be rejected in future releases.", "2.11") override def remove(n: Int, count: Int) { + if (n >= len) + return + if (count < 0) + throw new IllegalArgumentException(s"removing negative number ($count) of elements") if (exported) copy() val n1 = n max 0 val count1 = count min (len - n1) |