Explorar o código

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 %!s(int64=2) %!d(string=hai) anos
pai
achega
cd88ae87be
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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)