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 năm trước cách đây
mục cha
commit
cd88ae87be
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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)