Forráskód Böngészése

Merge pull request #645 from deltachat/tweak-wrapper2

restore chat only if existant, the missing changes
nayooti 5 éve
szülő
commit
b5e20a9225
1 módosított fájl, 5 hozzáadás és 1 törlés
  1. 5 1
      deltachat-ios/Coordinator/AppCoordinator.swift

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

@@ -103,7 +103,11 @@ class AppCoordinator: NSObject, Coordinator {
         } else {
         } else {
             showTab(index: lastActiveTab)
             showTab(index: lastActiveTab)
             if let lastActiveChatId = appStateRestorer.restoreLastActiveChatId(), lastActiveTab == 1 {
             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)
+                }
             }
             }
         }
         }
     }
     }