diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccount.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccount.kt index 0a84b13..ac17d51 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccount.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccount.kt @@ -94,11 +94,12 @@ class DirectAccount(context: Context) : Account { return response.request.newBuilder().header("Authorization", credential).build() } - private fun responseCount(_response: Response): Int { - var response = _response + /** Count number of authentication request/response */ + private fun responseCount(response: Response): Int { + var mutResponse = response var result = 1 - while (response.priorResponse?.also { - response = it + while (mutResponse.priorResponse?.also { + mutResponse = it } != null ) { result++