summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-09-02 17:01:28 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-02 17:01:28 -0700
commita59e3146b7dc298043e43e1816e3415b2583a3c8 (patch)
treed2a28db8b6d7c999fa10d2e941596cdce2dc856f
parent44671725bf9abbf34999d7afd3e998d2c4c6cd1a (diff)
parente1bf486846ce7589727ad84440bd9a2d42751055 (diff)
downloadframeworks_base-a59e3146b7dc298043e43e1816e3415b2583a3c8.zip
frameworks_base-a59e3146b7dc298043e43e1816e3415b2583a3c8.tar.gz
frameworks_base-a59e3146b7dc298043e43e1816e3415b2583a3c8.tar.bz2
Merge "Fix bug 5201420 - Appease the monkeys"
-rw-r--r--core/java/android/widget/ListView.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 133f435..5a97317 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -3384,11 +3384,11 @@ public class ListView extends AbsListView {
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
+ final ListAdapter adapter = mAdapter;
int closetChildIndex = -1;
- if (gainFocus && previouslyFocusedRect != null) {
+ if (adapter != null && gainFocus && previouslyFocusedRect != null) {
previouslyFocusedRect.offset(mScrollX, mScrollY);
- final ListAdapter adapter = mAdapter;
// Don't cache the result of getChildCount or mFirstPosition here,
// it could change in layoutChildren.
if (adapter.getCount() < getChildCount() + mFirstPosition) {