Skip to content

Commit 22b4dd0

Browse files
committed
do not show filter contact source dialog if theres no available sources
1 parent 98424eb commit 22b4dd0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/dialogs/FilterContactSourcesDialog.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ class FilterContactSourcesDialog(val activity: SimpleActivity, val callback: ()
1515

1616
init {
1717
ContactsHelper(activity).getContactSources {
18+
if (it.isEmpty()) {
19+
return@getContactSources
20+
}
21+
1822
val selectedSources = activity.config.displayContactSources
1923
activity.runOnUiThread {
2024
view.filter_contact_sources_list.adapter = FilterContactSourcesAdapter(activity, it, selectedSources)

app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
231231
cursor = activity.contentResolver.query(uri, projection, null, null, null)
232232
if (cursor?.moveToFirst() == true) {
233233
do {
234-
val name = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME)
234+
val name = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME) ?: continue
235235
accounts.add(name)
236236
} while (cursor.moveToNext())
237237
}

0 commit comments

Comments
 (0)