From b0ee9e80d4cc6fd3a1dbfd9534478e4b7ca05a7a Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Thu, 11 Sep 2025 16:53:02 +0200 Subject: [PATCH] Fix crash in updateEncryption by safely handling optional currentCall --- Linphone/UI/Call/ViewModel/CallViewModel.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Linphone/UI/Call/ViewModel/CallViewModel.swift b/Linphone/UI/Call/ViewModel/CallViewModel.swift index ba6f29ac2..02da3cea9 100644 --- a/Linphone/UI/Call/ViewModel/CallViewModel.swift +++ b/Linphone/UI/Call/ViewModel/CallViewModel.swift @@ -985,14 +985,11 @@ class CallViewModel: ObservableObject { self.isNotEncrypted = false } case MediaEncryption.None: + let isNotEncryptedTmp = self.currentCall?.state == .StreamsRunning DispatchQueue.main.async { self.isMediaEncrypted = false self.isZrtp = false - if self.currentCall!.state == .StreamsRunning { - self.isNotEncrypted = true - } else { - self.isNotEncrypted = false - } + self.isNotEncrypted = isNotEncryptedTmp } } }