Browse Source

fix out of bounds error in search

I came across this error while testing the search field on mac.
could have something to do with pressing backspace when the search field is empty
Simon Laux 2 years ago
parent
commit
cd88ae87be
1 changed files with 1 additions and 1 deletions
  1. 1 1
      deltachat-ios/ViewModel/ChatListViewModel.swift

+ 1 - 1
deltachat-ios/ViewModel/ChatListViewModel.swift

@@ -103,7 +103,7 @@ class ChatListViewModel: NSObject {
     }
 
     func cellDataFor(section: Int, row: Int) -> AvatarCellViewModel {
-        if showSearchResults {
+        if showSearchResults && !searchResultSections.isEmpty {
             switch searchResultSections[section] {
             case .chats:
                 return makeChatCellViewModel(index: row, searchText: searchText)