Merge "Throw IndexOutOfBoundsException for invalid start/count values"
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 44aabd2..7c7ad91 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -4636,7 +4636,6 @@
}
private void removeViewInternal(int index, View view) {
-
if (mTransition != null) {
mTransition.removeChild(this, view);
}
@@ -4729,12 +4728,17 @@
}
private void removeViewsInternal(int start, int count) {
+ final int end = start + count;
+
+ if (start < 0 || count < 0 || end > mChildrenCount) {
+ throw new IndexOutOfBoundsException();
+ }
+
final View focused = mFocused;
final boolean detach = mAttachInfo != null;
boolean clearChildFocus = false;
final View[] children = mChildren;
- final int end = start + count;
for (int i = start; i < end; i++) {
final View view = children[i];