Prevent attempt to restore article selection when there are no articles

This commit is contained in:
Maurice Parker 2019-09-06 10:38:02 -05:00
parent 9f6203e839
commit d0570d16a8
1 changed files with 3 additions and 0 deletions

View File

@ -156,6 +156,8 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
} }
func updateArticleSelection(animate: Bool) { func updateArticleSelection(animate: Bool) {
guard !coordinator.articles.isEmpty else { return }
if let indexPath = coordinator.currentArticleIndexPath { if let indexPath = coordinator.currentArticleIndexPath {
if tableView.indexPathForSelectedRow != indexPath { if tableView.indexPathForSelectedRow != indexPath {
tableView.selectRow(at: indexPath, animated: animate, scrollPosition: .middle) tableView.selectRow(at: indexPath, animated: animate, scrollPosition: .middle)
@ -163,6 +165,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
} else { } else {
tableView.selectRow(at: nil, animated: animate, scrollPosition: .none) tableView.selectRow(at: nil, animated: animate, scrollPosition: .none)
} }
updateUI() updateUI()
} }