avoid creating Account object with empty name or type

This commit is contained in:
tibbi
2018-05-13 21:37:43 +02:00
parent c0ad8662f4
commit c8dba03e71

View File

@ -698,7 +698,9 @@ class ContactsHelper(val activity: Activity) {
} }
} }
val contentResolverAccounts = getContentResolverAccounts().filter { !accounts.contains(Account(it.name, it.type)) } val contentResolverAccounts = getContentResolverAccounts().filter {
it.name.isNotEmpty() && it.type.isNotEmpty() && !accounts.contains(Account(it.name, it.type))
}
sources.addAll(contentResolverAccounts) sources.addAll(contentResolverAccounts)
if (sources.isEmpty() && activity.config.localAccountName.isEmpty() && activity.config.localAccountType.isEmpty()) { if (sources.isEmpty() && activity.config.localAccountName.isEmpty() && activity.config.localAccountType.isEmpty()) {