소스 검색

fix a index out of bounds crash

Simon Laux 2 년 전
부모
커밋
1ac77d06ff
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      deltachat-ios/ViewModel/ChatListViewModel.swift

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

@@ -128,7 +128,7 @@ class ChatListViewModel: NSObject {
 
 
     // only visible on search results
     // only visible on search results
     func titleForHeaderIn(section: Int) -> String? {
     func titleForHeaderIn(section: Int) -> String? {
-        if showSearchResults {
+        if showSearchResults && !searchResultSections.isEmpty {
             switch searchResultSections[section] {
             switch searchResultSections[section] {
             case .chats:
             case .chats:
                 return String.localized(stringID: "n_chats", count: numberOfRowsIn(section: section))
                 return String.localized(stringID: "n_chats", count: numberOfRowsIn(section: section))