diff --git a/apps/ios/SimpleXChat/ErrorAlert.swift b/apps/ios/SimpleXChat/ErrorAlert.swift index 65ed4c6717..5b9acc4fca 100644 --- a/apps/ios/SimpleXChat/ErrorAlert.swift +++ b/apps/ios/SimpleXChat/ErrorAlert.swift @@ -72,25 +72,25 @@ extension View { _ errorAlert: Binding, @ViewBuilder actions: (ErrorAlert) -> A = { _ in EmptyView() } ) -> some View { - if let alert = errorAlert.wrappedValue { - self.alert( - alert.title, - isPresented: Binding( - get: { errorAlert.wrappedValue != nil }, - set: { if !$0 { errorAlert.wrappedValue = nil } } - ), - actions: { - if let actions_ = alert.actions { - actions_() - } else { - actions(alert) - } - }, - message: { - if let message = alert.message { Text(message) } + alert( + errorAlert.wrappedValue?.title ?? "", + isPresented: Binding( + get: { errorAlert.wrappedValue != nil }, + set: { if !$0 { errorAlert.wrappedValue = nil } } + ), + actions: { + if let actions_ = errorAlert.wrappedValue?.actions { + actions_() + } else { + if let alert = errorAlert.wrappedValue { actions(alert) } } - ) - } else { self } + }, + message: { + if let message = errorAlert.wrappedValue?.message { + Text(message) + } + } + ) } }