catch and show exceptions thrown at adding blocked numbers

This commit is contained in:
tibbi 2018-12-27 20:27:23 +01:00
parent 4236414aa2
commit 2c1218870d
1 changed files with 5 additions and 1 deletions

View File

@ -332,7 +332,11 @@ fun Context.getBlockedNumbers(): ArrayList<BlockedNumber> {
fun Context.addBlockedNumber(number: String) {
ContentValues().apply {
put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number)
contentResolver.insert(BlockedNumbers.CONTENT_URI, this)
try {
contentResolver.insert(BlockedNumbers.CONTENT_URI, this)
} catch (e: Exception) {
showErrorToast(e)
}
}
}