mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-02-22 06:17:42 +01:00
adding a crashfix at call manager
This commit is contained in:
parent
526327bdb1
commit
34c27c530d
@ -34,9 +34,7 @@ class CallManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun registerCallback(callback: Call.Callback) {
|
fun registerCallback(callback: Call.Callback) {
|
||||||
if (call != null) {
|
call?.registerCallback(callback)
|
||||||
call!!.registerCallback(callback)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unregisterCallback(callback: Call.Callback) {
|
fun unregisterCallback(callback: Call.Callback) {
|
||||||
@ -62,7 +60,14 @@ class CallManager {
|
|||||||
return@ensureBackgroundThread
|
return@ensureBackgroundThread
|
||||||
}
|
}
|
||||||
|
|
||||||
val uri = Uri.decode(call!!.details.handle.toString())
|
// something here can be null even after the previous check, so do it like this
|
||||||
|
val handle = call?.details?.handle?.toString()
|
||||||
|
if (handle == null) {
|
||||||
|
callback(callContact)
|
||||||
|
return@ensureBackgroundThread
|
||||||
|
}
|
||||||
|
|
||||||
|
val uri = Uri.decode(handle)
|
||||||
if (uri.startsWith("tel:")) {
|
if (uri.startsWith("tel:")) {
|
||||||
val number = uri.substringAfter("tel:")
|
val number = uri.substringAfter("tel:")
|
||||||
callContact.number = number
|
callContact.number = number
|
||||||
|
Loading…
x
Reference in New Issue
Block a user