From 145ffbfcf01c071880250a41c1b3a1cec6824c68 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 24 Jul 2024 20:31:37 -0700 Subject: [PATCH] Fix crash when selection changes to nil in custom alert Closes #517 --- Tusker/Screens/Utilities/CustomAlertController.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tusker/Screens/Utilities/CustomAlertController.swift b/Tusker/Screens/Utilities/CustomAlertController.swift index cf3b2bb52f..6fb796ca91 100644 --- a/Tusker/Screens/Utilities/CustomAlertController.swift +++ b/Tusker/Screens/Utilities/CustomAlertController.swift @@ -320,12 +320,12 @@ class CustomAlertActionsView: UIControl { actionButtons[currentSelectedActionIndex].backgroundColor = nil } #if !os(visionOS) - if #available(iOS 17.5, *) { - let view = selectedButton!.element - let location = convert(CGPoint(x: view.bounds.midX, y: view.bounds.midY), from: view) - generator.selectionChanged(at: location) - } else { - generator.selectionChanged() + if selectedButton != nil { + if #available(iOS 17.5, *) { + generator.selectionChanged(at: recognizer.location(in: generator.view)) + } else { + generator.selectionChanged() + } } #endif