fix some null pointer crashes
This commit is contained in:
parent
ebd5d48603
commit
3b7b74b074
|
@ -45,7 +45,7 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:3.18.17'
|
implementation 'com.simplemobiletools:commons:3.18.23'
|
||||||
implementation 'joda-time:joda-time:2.9.9'
|
implementation 'joda-time:joda-time:2.9.9'
|
||||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||||
|
|
||||||
|
|
|
@ -148,11 +148,11 @@ class EditContactActivity : ContactActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contact!!.id == 0 && intent.extras?.containsKey(KEY_PHONE) == true && (action == Intent.ACTION_INSERT_OR_EDIT || action == Intent.ACTION_INSERT)) {
|
if (contact!!.id == 0 && intent.extras?.containsKey(KEY_PHONE) == true && (action == Intent.ACTION_INSERT_OR_EDIT || action == Intent.ACTION_INSERT)) {
|
||||||
val phoneNumber = intent.extras.get(KEY_PHONE).toString()
|
val phoneNumber = intent.extras.get(KEY_PHONE).toString() ?: ""
|
||||||
contact!!.phoneNumbers.add(PhoneNumber(phoneNumber, DEFAULT_PHONE_NUMBER_TYPE))
|
contact!!.phoneNumbers.add(PhoneNumber(phoneNumber, DEFAULT_PHONE_NUMBER_TYPE))
|
||||||
setupPhoneNumbers()
|
setupPhoneNumbers()
|
||||||
|
|
||||||
val contactFullName = intent.extras.get(KEY_NAME).toString()
|
val contactFullName = intent.extras.get(KEY_NAME)?.toString() ?: ""
|
||||||
contact_first_name.setText(contactFullName)
|
contact_first_name.setText(contactFullName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
||||||
if (cursor?.moveToFirst() == true) {
|
if (cursor?.moveToFirst() == true) {
|
||||||
do {
|
do {
|
||||||
val id = cursor.getLongValue(ContactsContract.Groups._ID)
|
val id = cursor.getLongValue(ContactsContract.Groups._ID)
|
||||||
val title = cursor.getStringValue(ContactsContract.Groups.TITLE)
|
val title = cursor.getStringValue(ContactsContract.Groups.TITLE) ?: continue
|
||||||
|
|
||||||
val systemId = cursor.getStringValue(ContactsContract.Groups.SYSTEM_ID)
|
val systemId = cursor.getStringValue(ContactsContract.Groups.SYSTEM_ID)
|
||||||
if (groups.map { it.title }.contains(title) && systemId != null) {
|
if (groups.map { it.title }.contains(title) && systemId != null) {
|
||||||
|
|
Loading…
Reference in New Issue