From 3b3748f1709c4ff645ab6bcbfe2b603f2ef573d3 Mon Sep 17 00:00:00 2001 From: prudhvi reddy Date: Sun, 8 Nov 2020 12:55:39 +0530 Subject: [PATCH] Fix #2090: avoid bang bang operator in networkinterceptor (#2091) * removed bang bang operator in NetworkInterceptor.kt and used let for null check * renamed it to responseBody for higher order function --- .../oppia/android/data/backends/gae/NetworkInterceptor.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/src/main/java/org/oppia/android/data/backends/gae/NetworkInterceptor.kt b/data/src/main/java/org/oppia/android/data/backends/gae/NetworkInterceptor.kt index 23032163499..7a4d5e4270b 100755 --- a/data/src/main/java/org/oppia/android/data/backends/gae/NetworkInterceptor.kt +++ b/data/src/main/java/org/oppia/android/data/backends/gae/NetworkInterceptor.kt @@ -22,10 +22,10 @@ class NetworkInterceptor @Inject constructor() : Interceptor { val response = chain.proceed(request) if (response.code() == Constants.HTTP_OK) { - if (response.body() != null) { - var rawJson = response.body()!!.string() + response.body()?.let { responseBody -> + var rawJson = responseBody.string() rawJson = removeXSSIPrefix(rawJson) - val contentType = response.body()!!.contentType() + val contentType = responseBody.contentType() val body = ResponseBody.create(contentType, rawJson) return response.newBuilder().body(body).build() }