From 95a1750bdad6b8304814304b2ab929c6491ff09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 14 Mar 2024 08:40:07 +0100 Subject: [PATCH] Call completion block in all cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- NextcloudTalk/NCAPIControllerExtensions.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/NextcloudTalk/NCAPIControllerExtensions.swift b/NextcloudTalk/NCAPIControllerExtensions.swift index aafcf7b86..d6da8481f 100644 --- a/NextcloudTalk/NCAPIControllerExtensions.swift +++ b/NextcloudTalk/NCAPIControllerExtensions.swift @@ -95,17 +95,17 @@ import Foundation } public func getRoomCapabilities(for accountId: String, token: String, completionBlock: @escaping (_ roomCapabilities: [String: AnyObject]?, _ proxyHash: String?) -> Void) { - guard let encodedToken = token.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) else { return } - let account = NCDatabaseManager.sharedInstance().talkAccount(forAccountId: accountId)! - let apiVersion = self.conversationAPIVersion(for: account) - let urlString = self.getRequestURL(forEndpoint: "room/\(encodedToken)/capabilities", withAPIVersion: apiVersion, for: account) - - guard let apiSessionManager = self.apiSessionManagers.object(forKey: account.accountId) as? NCAPISessionManager + guard let account = NCDatabaseManager.sharedInstance().talkAccount(forAccountId: accountId), + let apiSessionManager = self.apiSessionManagers.object(forKey: account.accountId) as? NCAPISessionManager, + let encodedToken = token.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) else { completionBlock(nil, nil) return } + let apiVersion = self.conversationAPIVersion(for: account) + let urlString = self.getRequestURL(forEndpoint: "room/\(encodedToken)/capabilities", withAPIVersion: apiVersion, for: account) + apiSessionManager.get(urlString, parameters: nil, progress: nil) { task, result in if let ocs = self.getOcsResponse(data: result), let data = ocs["data"] as? [String: AnyObject],