From d2e28ab672d5734a76f97f48174a3e6e8339e183 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Sat, 30 Jan 2021 12:56:45 -0500 Subject: [PATCH] Silently ignore 'bio == null' NullPointerExceptions (#6534) Closes: https://github.com/square/okhttp/issues/6509 --- okhttp/src/main/kotlin/okhttp3/internal/Util.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/okhttp/src/main/kotlin/okhttp3/internal/Util.kt b/okhttp/src/main/kotlin/okhttp3/internal/Util.kt index 55a8b7b2c76c..1383feae6599 100644 --- a/okhttp/src/main/kotlin/okhttp3/internal/Util.kt +++ b/okhttp/src/main/kotlin/okhttp3/internal/Util.kt @@ -499,6 +499,11 @@ fun Socket.closeQuietly() { } catch (e: AssertionError) { throw e } catch (rethrown: RuntimeException) { + if (rethrown.message == "bio == null") { + // Conscrypt in Android 10 and 11 may throw closing an SSLSocket. This is safe to ignore. + // https://issuetracker.google.com/issues/177450597 + return + } throw rethrown } catch (_: Exception) { }