Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9b09d5c authored by Maurice Chu's avatar Maurice Chu
Browse files

Fix NPE due to uncomputed formatted phone numbers

Compute the formatted phone number in the case that it
was not computed from the ContactLoader.  This can happen
because contacts loaded via the QuickContacts activity are
passed into the ContactDetailFragment, but the formatted
phone numbers are not computed in QuickContacts.

Bug: 7003015
Change-Id: I999b6ba8e3e3292b055a8fa1fe667a5c8304c983
parent f4bb763f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -573,6 +573,15 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen
                    PhoneDataItem phone = (PhoneDataItem) dataItem;
                    // Build phone entries
                    entry.data = phone.getFormattedPhoneNumber();
                    if (entry.data == null) {
                        // This case happens when the quick contact was opened from the contact
                        // list, and then, the user touches the quick contact image and brings the
                        // user to the detail card.  In this case, the Contact object that was
                        // loaded from quick contacts does not contain the formatted phone number,
                        // so it must be loaded here.
                        phone.computeFormattedPhoneNumber(mDefaultCountryIso);
                        entry.data = phone.getFormattedPhoneNumber();
                    }
                    final Intent phoneIntent = mHasPhone ?
                            ContactsUtils.getCallIntent(entry.data) : null;
                    final Intent smsIntent = mHasSms ? new Intent(Intent.ACTION_SENDTO,