diff --git a/library/src/main/java/com/nextcloud/common/NextcloudClient.kt b/library/src/main/java/com/nextcloud/common/NextcloudClient.kt index ecec940472..2f4e5c6d47 100644 --- a/library/src/main/java/com/nextcloud/common/NextcloudClient.kt +++ b/library/src/main/java/com/nextcloud/common/NextcloudClient.kt @@ -112,11 +112,15 @@ class NextcloudClient private constructor( } catch (ex: Exception) { RemoteOperationResult(ex) } - if (result.httpCode == HttpStatus.SC_BAD_REQUEST) { - val url = remoteOperation.client.hostConfiguration.hostURL + val ownCloudClient = remoteOperation.client + if (ownCloudClient == null) { + Log_OC.e(TAG, "OwnCloudClient is null") + } else if (result.httpCode == HttpStatus.SC_BAD_REQUEST) { + val url = ownCloudClient.hostConfiguration.hostURL Log_OC.e(TAG, "Received http status 400 for $url -> removing client certificate") AdvancedX509KeyManager(context).removeKeys(url) } + return result }