summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2013-05-09 14:43:16 -0700
committerJim Miller <jaggies@google.com>2013-05-09 16:23:34 -0700
commit982d21b9dc73eebd4b68a63579cf8be78c788c32 (patch)
treeae3998a8487149cdddae946cf072d1275e60a027 /policy
parentffe3b5b89fa58f7b12a2fc690c89480fc16a9fd6 (diff)
downloadframeworks_base-982d21b9dc73eebd4b68a63579cf8be78c788c32.zip
frameworks_base-982d21b9dc73eebd4b68a63579cf8be78c788c32.tar.gz
frameworks_base-982d21b9dc73eebd4b68a63579cf8be78c788c32.tar.bz2
Attempt to fix NPE in keyguard
This attempts to fix a bug where it looks like we have null content in one of the widget pages in keyguard. Based on the bug description, it's likely the transport control was just removed from the view hierarchy. Not sure how the content can be null in this case, but this will hopefully prevent the crash and give us some insight into what caused it. Fixes bug 8886916 Change-Id: I22c26c49f22fa5b06987e8199070a9aaead2ff8a
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index fbeca4f..c470870 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -326,10 +326,15 @@ public class KeyguardHostView extends KeyguardViewBase {
}
private int getWidgetPosition(int id) {
- final int children = mAppWidgetContainer.getChildCount();
+ final KeyguardWidgetPager appWidgetContainer = mAppWidgetContainer;
+ final int children = appWidgetContainer.getChildCount();
for (int i = 0; i < children; i++) {
- if (mAppWidgetContainer.getWidgetPageAt(i).getContent().getId() == id) {
+ final View content = appWidgetContainer.getWidgetPageAt(i).getContent();
+ if (content != null && content.getId() == id) {
return i;
+ } else if (content == null) {
+ // Attempt to track down bug #8886916
+ Log.w(TAG, "*** Null content at " + "i=" + i + ",id=" + id + ",N=" + children);
}
}
return -1;