fix some null pointer crashes

This commit is contained in:
tibbi 2018-04-13 11:07:23 +02:00
parent ebd5d48603
commit 3b7b74b074
3 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:3.18.17'
implementation 'com.simplemobiletools:commons:3.18.23'
implementation 'joda-time:joda-time:2.9.9'
implementation 'com.facebook.stetho:stetho:1.5.0'

View File

@ -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)) {
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))
setupPhoneNumbers()
val contactFullName = intent.extras.get(KEY_NAME).toString()
val contactFullName = intent.extras.get(KEY_NAME)?.toString() ?: ""
contact_first_name.setText(contactFullName)
}

View File

@ -442,7 +442,7 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
if (cursor?.moveToFirst() == true) {
do {
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)
if (groups.map { it.title }.contains(title) && systemId != null) {