1
0
mirror of https://github.com/etesync/android synced 2025-01-11 00:01:12 +00:00

TaskList: catch exception when trying to acquire task list

This commit is contained in:
Tom Hacohen 2019-08-29 14:25:49 +01:00
parent c48c452f28
commit ffb7f53c0a

View File

@ -34,8 +34,13 @@ class LocalTaskList private constructor(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
return context.packageManager.resolveContentProvider(TaskProvider.ProviderName.OpenTasks.authority, 0) != null
else {
val provider = TaskProvider.acquire(context, TaskProvider.ProviderName.OpenTasks)
provider?.use { return true }
try {
TaskProvider.acquire(context, TaskProvider.ProviderName.OpenTasks)?.use {
return true
}
} catch (e: Exception) {
// couldn't acquire task provider
}
return false
}
}