         let chatViewController = storyboard.instantiateViewController(withIdentifier: "ChatViewController") as? ChatViewController
         chatViewController?.injectionContainer = injectionContainer
         guard let realm = try? Realm() else { return nil }
-        chatViewController?.subscription = Subscription.find(rid: room, realm: realm)
+        guard let subscription = Subscription.find(rid: room, realm: realm) else { return nil }
+        chatViewController?.subscription = subscription
         return chatViewController
     }
 

            fatalError("LiveChatManager methods called before properly initiated.")
        }

        let params = [
            "msg": "method",
            "method": "login",
            "params": [[
                "resume": token
            ]]
        ] as [String : Any]
        socketManager.send(params) { _ in
            self.loggedIn = true
            DispatchQueue.global(qos: .background).async(execute: completion)
        }

            let json = response.result["result"]
            self.userId = json["userId"].stringValue
            self.token = json["token"].stringValue

            self.login {
                let roomSubscription = Subscription()
                roomSubscription.identifier = UUID().uuidString
                roomSubscription.rid = self.room
                roomSubscription.name = department.name
                Realm.execute({ realm in
                    realm.add(roomSubscription)
                })
