diff options
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 5 | ||||
| -rw-r--r-- | core/java/android/widget/ListView.java | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 3153ac5aaadd..9f1eef92d33a 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -4275,11 +4275,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * does not exist within the group */ public View getChildAt(int index) { - try { - return mChildren[index]; - } catch (IndexOutOfBoundsException ex) { + if (index < 0 || index >= mChildrenCount) { return null; } + return mChildren[index]; } /** diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 427126b0e68e..af954c9022e6 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -3019,12 +3019,13 @@ public class ListView extends AbsListView { hasOpaqueScrollbars()) || super.isOpaque(); if (retValue) { // only return true if the list items cover the entire area of the view - final int listTop = mListPadding.top; + final int listTop = mListPadding != null ? mListPadding.top : mPaddingTop; View first = getChildAt(0); if (first == null || first.getTop() > listTop) { return false; } - final int listBottom = getHeight() - mListPadding.bottom; + final int listBottom = getHeight() - + (mListPadding != null ? mListPadding.bottom : mPaddingBottom); View last = getChildAt(getChildCount() - 1); if (last == null || last.getBottom() < listBottom) { return false; |