From 0c50209b66a415674d2157f56b01a21311772d76 Mon Sep 17 00:00:00 2001 From: Sami Eljabali Date: Wed, 7 Aug 2024 16:08:09 +0300 Subject: [PATCH] Update isHealthy check to be safer --- .../kotlin/okhttp3/internal/connection/RealConnection.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt b/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt index 432dcc074e7e..55d4d328a1ec 100644 --- a/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt +++ b/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt @@ -321,9 +321,9 @@ class RealConnection( val nowNs = System.nanoTime() - val rawSocket = this.rawSocket!! - val socket = this.socket!! - val source = this.source!! + val rawSocket = this.rawSocket ?: return false + val socket = this.socket ?: return false + val source = this.source ?: return false if (rawSocket.isClosed || socket.isClosed || socket.isInputShutdown || socket.isOutputShutdown ) {