Prevent crash if exception occurs in native contact editor
This commit is contained in:
parent
84f0aceb61
commit
2748a34c25
1 changed files with 17 additions and 13 deletions
|
@ -50,6 +50,7 @@ class NativeContactEditor(val contact: NativeContact) {
|
|||
val uri = result.uri
|
||||
Log.i("[Native Contact Editor] Contact creation result is $uri")
|
||||
if (uri != null) {
|
||||
try {
|
||||
val cursor = contentResolver.query(
|
||||
uri,
|
||||
arrayOf(RawContacts.CONTACT_ID),
|
||||
|
@ -64,6 +65,9 @@ class NativeContactEditor(val contact: NativeContact) {
|
|||
cursor.close()
|
||||
return contactId
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e("[Native Contact Editor] Failed to get cursor: $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue