Avoid crash when table is empty

This commit is contained in:
Bob Sun 2017-06-03 22:45:53 -07:00
parent 9b2fa6acbe
commit b48a7438ed
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -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
}