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