From f0cb7bc558af63923208a97f2eadddde80d8a521 Mon Sep 17 00:00:00 2001 From: Harry Sanabria Date: Wed, 12 Oct 2022 13:13:15 -0700 Subject: [PATCH] Fix crash from reloading of existing story cell when inserting new cell above it --- .../HomeView/Stories/StoryListDataSource.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/Stories/StoryListDataSource.swift b/Signal/src/ViewControllers/HomeView/Stories/StoryListDataSource.swift index 560fe2d1fc..1b3ef356cd 100644 --- a/Signal/src/ViewControllers/HomeView/Stories/StoryListDataSource.swift +++ b/Signal/src/ViewControllers/HomeView/Stories/StoryListDataSource.swift @@ -607,9 +607,9 @@ class StoryListDataSource: NSObject, Dependencies { case .move(let oldIndex, let newIndex): tableView.deleteRows(at: [IndexPath(row: oldIndex, section: section.rawValue)], with: .fade) tableView.insertRows(at: [IndexPath(row: newIndex, section: section.rawValue)], with: .fade) - case .update(_, let newIndex): + case .update(let oldIndex, let newIndex): // If the cell is visible, reconfigure it directly without reloading. - let path = IndexPath(row: newIndex, section: section.rawValue) + let path = IndexPath(row: oldIndex, section: section.rawValue) if (tableView.indexPathsForVisibleRows ?? []).contains(path), let visibleCell = tableView.cellForRow(at: path) as? StoryCell