ignore phone number entries without a number

This commit is contained in:
tibbi 2018-01-23 21:13:12 +01:00
parent 83418936f5
commit 71d40b0e08
1 changed files with 3 additions and 2 deletions

View File

@ -106,14 +106,15 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
if (cursor?.moveToFirst() == true) {
do {
val id = cursor.getIntValue(ContactsContract.Data.RAW_CONTACT_ID)
val number = cursor.getStringValue(CommonDataKinds.Phone.NUMBER)
val number = cursor.getStringValue(CommonDataKinds.Phone.NUMBER) ?: continue
val type = cursor.getIntValue(CommonDataKinds.Phone.TYPE)
if (phoneNumbers[id] == null) {
phoneNumbers.put(id, ArrayList())
}
phoneNumbers[id].add(PhoneNumber(number, type))
val phoneNumber = PhoneNumber(number, type)
phoneNumbers[id].add(phoneNumber)
} while (cursor.moveToNext())
}
} finally {