diff options
author | Jay Shrauner <shrauner@google.com> | 2014-10-24 08:12:15 -0700 |
---|---|---|
committer | Jay Shrauner <shrauner@google.com> | 2014-10-24 08:12:15 -0700 |
commit | f173b2e79f9ad4210b5e7c8f72795525cfb46859 (patch) | |
tree | 4485290cb822d5630463360ca517e07a4a1bec7d /InCallUI | |
parent | 83d3d2e52f0168f8e9e79bbd60b546a411929f08 (diff) |
Fix NPE in findInfoQueryComplete
Ensure cacheEntry is always built.
Bug:18111087
Change-Id: If1985902c9a6d34c0f5a31788079102010eb1630
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/ContactInfoCache.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index bf67a6702..f8bd38d2b 100644 --- a/InCallUI/src/com/android/incallui/ContactInfoCache.java +++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java @@ -157,12 +157,10 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete } ContactCacheEntry cacheEntry = mInfoMap.get(callId); - // Rebuild the entry from the new data if: - // 1) This is NOT the asynchronous local lookup (IOW, this is the first pass) - // 2) The local lookup was done and the contact exists - // 3) The existing cached entry is empty (no name). - if (!didLocalLookup || callerInfo.contactExists || - (cacheEntry != null && TextUtils.isEmpty(cacheEntry.name))) { + // Ensure we always have a cacheEntry. Replace the existing entry if + // it has no name or if we found a local contact. + if (cacheEntry == null || TextUtils.isEmpty(cacheEntry.name) || + callerInfo.contactExists) { cacheEntry = buildEntry(mContext, callId, callerInfo, presentationMode, isIncoming); mInfoMap.put(callId, cacheEntry); } @@ -170,7 +168,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete sendInfoNotifications(callId, cacheEntry); if (didLocalLookup) { - // Before issuing a request for more data from other services, We only check that the + // Before issuing a request for more data from other services, we only check that the // contact wasn't found in the local DB. We don't check the if the cache entry already // has a name because we allow overriding cnap data with data from other services. if (!callerInfo.contactExists && mPhoneNumberService != null) { |