From f004c823021c8cb80955027fcfd6f9ba346d1e01 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 15 May 2023 22:03:51 -0400 Subject: [PATCH] Fix crash if TimelineGapCollectionViewCell is somehow accessibility-activated --- .../Screens/Timeline/TimelineGapCollectionViewCell.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Timeline/TimelineGapCollectionViewCell.swift b/Tusker/Screens/Timeline/TimelineGapCollectionViewCell.swift index a852e221..0a065f0f 100644 --- a/Tusker/Screens/Timeline/TimelineGapCollectionViewCell.swift +++ b/Tusker/Screens/Timeline/TimelineGapCollectionViewCell.swift @@ -135,11 +135,12 @@ class TimelineGapCollectionViewCell: UICollectionViewCell { override var accessibilityCustomActions: [UIAccessibilityCustomAction]? { get { [TimelineGapDirection.below, .above].map { dir in - UIAccessibilityCustomAction(name: "Load \(dir.accessibilityLabel)") { [unowned self] _ in + UIAccessibilityCustomAction(name: "Load \(dir.accessibilityLabel)") { [weak self] _ in + guard let self else { return false } Task { - showsIndicator = true - await fillGap?(dir) - showsIndicator = false + self.showsIndicator = true + await self.fillGap?(dir) + self.showsIndicator = false } return true }