diff --git a/NextcloudTalk/NCSettingsController.m b/NextcloudTalk/NCSettingsController.m index df5145571..b0d23c734 100644 --- a/NextcloudTalk/NCSettingsController.m +++ b/NextcloudTalk/NCSettingsController.m @@ -188,9 +188,11 @@ - (void)tokenRevokedResponseReceived:(NSNotification *)notification { NSString *accountId = [notification.userInfo objectForKey:@"accountId"]; [self logoutAccountWithAccountId:accountId withCompletionBlock:^(NSError *error) { - [[NCUserInterfaceController sharedInstance] presentConversationsList]; - [[NCUserInterfaceController sharedInstance] presentLoggedOutInvalidCredentialsAlert]; - [[NCConnectionController sharedInstance] checkAppState]; + if (!error) { + [[NCUserInterfaceController sharedInstance] presentConversationsList]; + [[NCUserInterfaceController sharedInstance] presentLoggedOutInvalidCredentialsAlert]; + [[NCConnectionController sharedInstance] checkAppState]; + } }]; } @@ -417,6 +419,15 @@ - (void)getUserProfileForAccountId:(NSString *)accountId withCompletionBlock:(Up - (void)logoutAccountWithAccountId:(NSString *)accountId withCompletionBlock:(LogoutCompletionBlock)block { TalkAccount *removingAccount = [[NCDatabaseManager sharedInstance] talkAccountForAccountId:accountId]; + + if (!removingAccount) { + if (block) { + NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:nil]; + block(error); + } + return; + } + if (removingAccount.deviceIdentifier) { [[NCAPIController sharedInstance] unsubscribeAccount:removingAccount fromNextcloudServerWithCompletionBlock:^(NSError *error) { if (!error) {