From 614ac7f9cf642572310dc6d49dbb68c2aad04b98 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Sun, 16 Mar 2025 20:34:29 +0100 Subject: [PATCH] Prevent crash if DMTF setting doesn't exists (Samsung A51) --- .../java/org/linphone/core/CoreContext.kt | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/linphone/core/CoreContext.kt b/app/src/main/java/org/linphone/core/CoreContext.kt index ca69874cb..70254af20 100644 --- a/app/src/main/java/org/linphone/core/CoreContext.kt +++ b/app/src/main/java/org/linphone/core/CoreContext.kt @@ -30,6 +30,7 @@ import android.os.Handler import android.os.HandlerThread import android.os.Looper import android.provider.Settings +import android.provider.Settings.SettingNotFoundException import androidx.annotation.AnyThread import androidx.annotation.UiThread import androidx.annotation.WorkerThread @@ -896,14 +897,18 @@ class CoreContext @WorkerThread fun playDtmf(character: Char, duration: Int = 200, ignoreSystemPolicy: Boolean = false) { - if (ignoreSystemPolicy || Settings.System.getInt( - context.contentResolver, - Settings.System.DTMF_TONE_WHEN_DIALING - ) != 0 - ) { - core.playDtmf(character, duration) - } else { - Log.w("$TAG Numpad DTMF tones are disabled in system settings, not playing them") + try { + if (ignoreSystemPolicy || Settings.System.getInt( + context.contentResolver, + Settings.System.DTMF_TONE_WHEN_DIALING + ) != 0 + ) { + core.playDtmf(character, duration) + } else { + Log.w("$TAG Numpad DTMF tones are disabled in system settings, not playing them") + } + } catch (snfe: SettingNotFoundException) { + Log.e("$TAG DTMF_TONE_WHEN_DIALING system setting not found: $snfe") } }