summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2013-10-31 17:59:18 -0700
committer Adam Lesinski <adamlesinski@google.com> 2013-11-01 12:00:53 -0700
commit83c7ac3b8e5faadb73313c73d401803d5d52f55f (patch)
tree2aeefb1bb25776fd36de65cbd5394d7a575e5268
parent099d842bdac481ea94527ab1f702342e41dca440 (diff)
Fix off-by-one issue when removing from Iterator
MapCollections' iterator removes the preceding element which causes IndexOutOfBoundsExceptions to be thrown when removing the first element while iterating. bug:11477476 Change-Id: Ifc8fcf0ca1651e759f3b2ab8356404564e9f7d0b
-rw-r--r--core/java/android/util/MapCollections.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/util/MapCollections.java b/core/java/android/util/MapCollections.java
index f4a9b0bbb73e..28b788b97aa7 100644
--- a/core/java/android/util/MapCollections.java
+++ b/core/java/android/util/MapCollections.java
@@ -97,10 +97,10 @@ abstract class MapCollections<K, V> {
if (!mEntryValid) {
throw new IllegalStateException();
}
+ colRemoveAt(mIndex);
mIndex--;
mEnd--;
mEntryValid = false;
- colRemoveAt(mIndex);
}
@Override