diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-08-29 13:55:27 -0700 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2013-08-29 13:55:27 -0700 |
commit | 4a5339c4a266891ce560dfb6e348c3779a0a3ca1 (patch) | |
tree | e8b08e11753744f94ba6d8e673e5ce8b22b1b066 | |
parent | facff288cfbdfcfd9281a64fa05a78532acf3d90 (diff) |
Fix null precondition check.
Precondition was making sure call was not null. But the call could be null in
cases where the call disconnected before the UI comes up. In this case, we can
simply skip processing.
Bug: 10538437
Change-Id: Ia4ff093f38cdc32bdaf6325d9dc770b302d0060b
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index c06806926..d7386167b 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -70,18 +70,23 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> public void init(Context context, PhoneNumberService phoneNumberService, Call call) { mContext = Preconditions.checkNotNull(context); mPhoneNumberService = Preconditions.checkNotNull(phoneNumberService); - Preconditions.checkNotNull(call); mContext = context; mPhoneNumberService = phoneNumberService; - final CallIdentification identification = call.getIdentification(); - // TODO(klp): Logic to determine which ui field get what data resides in contactInfoCache. - // It needs to be moved so it can be re-used. - mPrimaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(mContext, identification, - call.getState() == Call.State.INCOMING); + // Call may be null if disconnect happened already. + if (call != null) { + final CallIdentification identification = call.getIdentification(); - // start processing lookups right away. - startContactInfoSearch(identification, true, false, call.getState() == Call.State.INCOMING); + // TODO(klp): Logic to determine which ui field get what data resides in + // contactInfoCache. + // It needs to be moved so it can be re-used. + mPrimaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(mContext, identification, + call.getState() == Call.State.INCOMING); + + // start processing lookups right away. + startContactInfoSearch(identification, true, false, + call.getState() == Call.State.INCOMING); + } } @Override |