From 9b33478f0034b3f7b50d30580f566c3347b8d7a9 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 15 Sep 2015 13:07:55 -0700 Subject: Handle null contact lookup. If we have a null contact lookup, replace the local reference with an EMPTY contact info instance. This fixes a test failure, and possible lookup scenario. Bug: 23640774 Change-Id: Ic83f1e73bfbb3b4e3920051f906a3d83524fc8cd --- src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/com/android') diff --git a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java index 5a62a7da1..aa994d25a 100644 --- a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java +++ b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java @@ -156,9 +156,13 @@ public class CallLogAsyncTaskUtil { boolean isVoicemail = PhoneNumberUtil.isVoicemailNumber(context, accountHandle, number); boolean shouldLookupNumber = PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation) && !isVoicemail; - ContactInfo info = shouldLookupNumber - ? contactInfoHelper.lookupNumber(number, countryIso) - : ContactInfo.EMPTY; + + ContactInfo info = ContactInfo.EMPTY; + if (shouldLookupNumber) { + ContactInfo lookupInfo = contactInfoHelper.lookupNumber(number, countryIso); + info = lookupInfo != null ? lookupInfo : ContactInfo.EMPTY; + } + PhoneCallDetails details = new PhoneCallDetails( context, number, numberPresentation, info.formattedNumber, isVoicemail); -- cgit v1.2.3