diff --git a/Tusker/Screens/Conversation/ConversationCollectionViewController.swift b/Tusker/Screens/Conversation/ConversationCollectionViewController.swift index f0274978..3431f273 100644 --- a/Tusker/Screens/Conversation/ConversationCollectionViewController.swift +++ b/Tusker/Screens/Conversation/ConversationCollectionViewController.swift @@ -336,8 +336,9 @@ extension ConversationCollectionViewController: UICollectionViewDelegate { selected(status: id, state: state.copy()) } case .expandThread(childThreads: let childThreads, inline: _): - if case .status(id: _, node: let node, state: let state, _, _) = dataSource.itemIdentifier(for: IndexPath(row: indexPath.row - 1, section: indexPath.section)) { - let tree = ConversationTree(ancestors: buildNewAncestors(above: indexPath), mainStatus: node) + let indexPathBeforeExpandThread = IndexPath(row: indexPath.row - 1, section: indexPath.section) + if case .status(id: _, node: let node, state: let state, _, _) = dataSource.itemIdentifier(for: indexPathBeforeExpandThread) { + let tree = ConversationTree(ancestors: buildNewAncestors(above: indexPathBeforeExpandThread), mainStatus: node) let conv = ConversationViewController(preloadedTree: tree, state: state.copy(), mastodonController: mastodonController) conv.statusIDToScrollToOnLoad = childThreads.first!.status.id conv.showStatusesAutomatically = showStatusesAutomatically