diff --git a/NextcloudTalk/NCAPIController.m b/NextcloudTalk/NCAPIController.m index 73db010fe..8ba1ec113 100644 --- a/NextcloudTalk/NCAPIController.m +++ b/NextcloudTalk/NCAPIController.m @@ -436,7 +436,12 @@ - (NSURLSessionDataTask *)joinRoom:(NSString *)token forAccount:(TalkAccount *)a [self checkResponseStatusCode:statusCode forAccount:account]; NSDictionary *errorDict = [[[self getFailureResponseObjectFromError:error] objectForKey:@"ocs"] objectForKey:@"data"]; - NSString *statusReason = [errorDict objectForKey:@"error"]; + NSString *statusReason = nil; + + // Depending on the error, an empty array instead of a dictionary is returned by the server + if (errorDict && [errorDict isKindOfClass:[NSDictionary class]]) { + statusReason = [errorDict objectForKey:@"error"]; + } if (block) { block(nil, nil, error, statusCode, statusReason);