Fixed crash in audio route utils

This commit is contained in:
Sylvain Berfini 2022-02-14 09:27:16 +01:00
parent 2794147fd7
commit a5658bf5ea

View file

@ -101,7 +101,7 @@ class AudioRouteUtils {
types: List<AudioDevice.Type>,
skipTelecom: Boolean = false
) {
val currentCall = call ?: coreContext.core.currentCall ?: if (coreContext.core.callsNb > 0) coreContext.core.calls[0] else null
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)