Reduce number of exit points

The method `onReceivedHttpError` did have 3 exit points (`return`), but Codacy only allows us 2, so error handling for `request?.url` and `view?.context` was combined. Seems debatable, what's more readable, but the rules are the rules.

Signed-off-by: Elv1zz <elv1zz.git@gmail.com>
This commit is contained in:
Elv1zz 2023-07-05 21:06:23 +02:00 committed by tobiasKaminsky
parent 7b776c8aa7
commit e2dd29052b
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -108,10 +108,13 @@ open class NextcloudWebViewClient(val supportFragmentManager: FragmentManager) :
) {
val errorCode = errorResponse?.statusCode ?: return
if (errorCode == HttpStatus.SC_BAD_REQUEST) {
Log_OC.w(tag, "WebView failed with error code $errorCode; remove key chain aliases")
// chosen client certificate alias does not seem to work -> discard it
val failingUrl = request?.url ?: return
val context = view?.context ?: return
val failingUrl = request?.url
val context = view?.context
if (failingUrl == null || context == null) {
return
}
Log_OC.w(tag, "WebView failed with error code $errorCode; remove key chain aliases")
AdvancedX509KeyManager(context).removeKeys(failingUrl)
}
}