From e8a492ef7d21e341fb873bcc5b5286a5d6cad0d4 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 26 Nov 2024 23:17:52 -0500 Subject: [PATCH] Fix potential crash with invalid attachment aspect ratio --- Tusker/Views/Attachments/AttachmentsContainerView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/Attachments/AttachmentsContainerView.swift b/Tusker/Views/Attachments/AttachmentsContainerView.swift index eb60dce2..22d4b9f6 100644 --- a/Tusker/Views/Attachments/AttachmentsContainerView.swift +++ b/Tusker/Views/Attachments/AttachmentsContainerView.swift @@ -295,7 +295,11 @@ class AttachmentsContainerView: UIView { accessibilityElements.append(moreView) } - self.aspectRatio = aspectRatio + self.aspectRatio = if aspectRatio.isNaN || aspectRatio.isInfinite { + 16/9 + } else { + aspectRatio + } } else { self.isHidden = true }