Fixed crash in dialer if DTMF_TONE_WHEN_DIALING setting isn't found

This commit is contained in:
Sylvain Berfini 2021-07-12 11:10:39 +02:00
parent bfbae245ce
commit 345941781b

View file

@ -67,13 +67,21 @@ class DialerViewModel : LogsUploadViewModel() {
if (coreContext.core.callsNb == 0) {
val contentResolver = coreContext.context.contentResolver
if (Settings.System.getInt(contentResolver, Settings.System.DTMF_TONE_WHEN_DIALING) == 1) {
try {
if (Settings.System.getInt(
contentResolver,
Settings.System.DTMF_TONE_WHEN_DIALING
) == 1
) {
coreContext.core.playDtmf(key, 1)
if (vibrator.hasVibrator() && corePreferences.dtmfKeypadVibration) {
Compatibility.eventVibration(vibrator)
}
}
} catch (snfe: Settings.SettingNotFoundException) {
Log.e("[Dialer] Can't play DTMF: $snfe")
}
}
}