mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-24 23:27:40 +01:00
avoid some null extras at third party intents
This commit is contained in:
parent
26061d8827
commit
2f59a84748
@ -153,14 +153,20 @@ class EditContactActivity : ContactActivity() {
|
|||||||
setupEditContact()
|
setupEditContact()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((contact!!.id == 0 && intent.extras?.containsKey(KEY_PHONE) == true && action == Intent.ACTION_INSERT) || action == ADD_NEW_CONTACT_NUMBER) {
|
if ((contact!!.id == 0 && intent.extras != null && intent.extras.containsKey(KEY_PHONE) && action == Intent.ACTION_INSERT) || action == ADD_NEW_CONTACT_NUMBER) {
|
||||||
val phoneNumber = intent.extras.get(KEY_PHONE)?.toString() ?: ""
|
val phone = intent.extras.get(KEY_PHONE)
|
||||||
contact!!.phoneNumbers.add(PhoneNumber(phoneNumber, DEFAULT_PHONE_NUMBER_TYPE, ""))
|
if (phone != null) {
|
||||||
if (phoneNumber.isNotEmpty() && action == ADD_NEW_CONTACT_NUMBER) {
|
val phoneNumber = phone.toString()
|
||||||
highlightLastPhoneNumber = true
|
contact!!.phoneNumbers.add(PhoneNumber(phoneNumber, DEFAULT_PHONE_NUMBER_TYPE, ""))
|
||||||
|
if (phoneNumber.isNotEmpty() && action == ADD_NEW_CONTACT_NUMBER) {
|
||||||
|
highlightLastPhoneNumber = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contact!!.firstName = intent.extras.get(KEY_NAME)?.toString() ?: ""
|
val firstName = intent.extras.get(KEY_NAME)
|
||||||
|
if (firstName != null) {
|
||||||
|
contact!!.firstName = firstName.toString()
|
||||||
|
}
|
||||||
|
|
||||||
val data = intent.extras.getParcelableArrayList<ContentValues>("data")
|
val data = intent.extras.getParcelableArrayList<ContentValues>("data")
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user