Merge "Fix NPE if SmartDialLoaderTask has null context"
diff --git a/src/com/android/dialer/dialpad/SmartDialLoaderTask.java b/src/com/android/dialer/dialpad/SmartDialLoaderTask.java
index 74f2e5e..8321837 100644
--- a/src/com/android/dialer/dialpad/SmartDialLoaderTask.java
+++ b/src/com/android/dialer/dialpad/SmartDialLoaderTask.java
@@ -168,14 +168,21 @@
stopWatch.stopAndLog("SmartDial Already Cached", 0);
return;
}
-
+ if (mContext == null) {
+ if (DEBUG) {
+ stopWatch.stopAndLog("Invalid context", 0);
+ }
+ return;
+ }
final Cursor c = mContext.getContentResolver().query(ContactQuery.URI,
(mNameDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY)
? ContactQuery.PROJECTION : ContactQuery.PROJECTION_ALTERNATIVE,
ContactQuery.SELECTION, null,
ContactQuery.ORDER_BY);
if (c == null) {
- stopWatch.stopAndLog("Query Failuregi", 0);
+ if (DEBUG) {
+ stopWatch.stopAndLog("Query Failure", 0);
+ }
return;
}
sContactsCache = Lists.newArrayListWithCapacity(c.getCount());