From 84f0aceb614312b0358097e4c755ed796ba3be11 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 24 Feb 2022 10:22:36 +0100 Subject: [PATCH] Fixed crash due to nil call ID, fixed wrong @notnil tag in SDK --- .../java/org/linphone/telecom/TelecomConnectionService.kt | 6 +++--- app/src/main/java/org/linphone/utils/AudioRouteUtils.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/linphone/telecom/TelecomConnectionService.kt b/app/src/main/java/org/linphone/telecom/TelecomConnectionService.kt index fa3f8c4de..b74aea297 100644 --- a/app/src/main/java/org/linphone/telecom/TelecomConnectionService.kt +++ b/app/src/main/java/org/linphone/telecom/TelecomConnectionService.kt @@ -176,7 +176,7 @@ class TelecomConnectionService : ConnectionService() { private fun onCallError(call: Call) { val callId = call.callLog.callId - val connection = TelecomHelper.get().findConnectionForCallId(callId) + val connection = TelecomHelper.get().findConnectionForCallId(callId.orEmpty()) if (connection == null) { Log.e("[Telecom Connection Service] Failed to find connection for call id: $callId") return @@ -189,7 +189,7 @@ class TelecomConnectionService : ConnectionService() { private fun onCallEnded(call: Call) { val callId = call.callLog.callId - val connection = TelecomHelper.get().findConnectionForCallId(callId) + val connection = TelecomHelper.get().findConnectionForCallId(callId.orEmpty()) if (connection == null) { Log.e("[Telecom Connection Service] Failed to find connection for call id: $callId") return @@ -204,7 +204,7 @@ class TelecomConnectionService : ConnectionService() { private fun onCallConnected(call: Call) { val callId = call.callLog.callId - val connection = TelecomHelper.get().findConnectionForCallId(callId) + val connection = TelecomHelper.get().findConnectionForCallId(callId.orEmpty()) if (connection == null) { Log.e("[Telecom Connection Service] Failed to find connection for call id: $callId") return diff --git a/app/src/main/java/org/linphone/utils/AudioRouteUtils.kt b/app/src/main/java/org/linphone/utils/AudioRouteUtils.kt index 584174ec0..b9ac064e0 100644 --- a/app/src/main/java/org/linphone/utils/AudioRouteUtils.kt +++ b/app/src/main/java/org/linphone/utils/AudioRouteUtils.kt @@ -104,7 +104,7 @@ class AudioRouteUtils { val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls.firstOrNull() if (currentCall != null && !skipTelecom && TelecomHelper.exists()) { Log.i("[Audio Route Helper] Call provided & Telecom Helper exists, trying to dispatch audio route change through Telecom API") - val connection = TelecomHelper.get().findConnectionForCallId(currentCall.callLog.callId) + val connection = TelecomHelper.get().findConnectionForCallId(currentCall.callLog.callId.orEmpty()) if (connection != null) { val route = when (types.first()) { AudioDevice.Type.Earpiece -> CallAudioState.ROUTE_EARPIECE