瀏覽代碼

restore chat only if existant

B. Petersen 5 年之前
父節點
當前提交
131d9350f8
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      deltachat-ios/Coordinator/AppCoordinator.swift

+ 5 - 1
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -103,7 +103,11 @@ class AppCoordinator: NSObject, Coordinator {
         } else {
             showTab(index: lastActiveTab)
             if let lastActiveChatId = appStateRestorer.restoreLastActiveChatId(), lastActiveTab == 1 {
-                showChat(chatId: lastActiveChatId, animated: false)
+                // as getChat() returns an empty object for invalid chatId,
+                // check that the returned object is actually set up.
+                if dcContext.getChat(chatId: lastActiveChatId).id == lastActiveChatId {
+                    showChat(chatId: lastActiveChatId, animated: false)
+                }
             }
         }
     }