From b48a7438ed4978b3fb74f26591cb50034633a70a Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Sat, 3 Jun 2017 22:45:53 -0700 Subject: [PATCH] Avoid crash when table is empty --- pass/Controllers/PasswordsViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pass/Controllers/PasswordsViewController.swift b/pass/Controllers/PasswordsViewController.swift index 3e284fe..69b4fca 100644 --- a/pass/Controllers/PasswordsViewController.swift +++ b/pass/Controllers/PasswordsViewController.swift @@ -535,7 +535,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV self.tapTabBarTime = currentTime if duration < 0.35 { let topIndexPath = IndexPath(row: 0, section: 0) - tableView.scrollToRow(at: topIndexPath, at: .bottom, animated: true) + if let _ = tableView.cellForRow(at: topIndexPath) { + tableView.scrollToRow(at: topIndexPath, at: .bottom, animated: true) + } self.tapTabBarTime = 0 return }