From 457bcd7123d69c18dd507c8c36922728e5107c06 Mon Sep 17 00:00:00 2001 From: vollkorntomate Date: Fri, 25 Nov 2022 15:43:07 +0100 Subject: [PATCH] Workaround crash when muting account --- .../ViewModels/View Models/CollectionItemsViewModel.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ViewModels/Sources/ViewModels/View Models/CollectionItemsViewModel.swift b/ViewModels/Sources/ViewModels/View Models/CollectionItemsViewModel.swift index 303ae85..17be6a0 100644 --- a/ViewModels/Sources/ViewModels/View Models/CollectionItemsViewModel.swift +++ b/ViewModels/Sources/ViewModels/View Models/CollectionItemsViewModel.swift @@ -98,6 +98,10 @@ public class CollectionItemsViewModel: ObservableObject { // swiftlint:disable:next function_body_length cyclomatic_complexity public func viewModel(indexPath: IndexPath) -> Any { + guard indexPath.section < lastUpdate.sections.count, + indexPath.item < lastUpdate.sections[indexPath.section].items.count else { + return false + } let item = lastUpdate.sections[indexPath.section].items[indexPath.item] let cachedViewModel = viewModelCache[item]