From eef35f93159ecf1b94a3a62dbf8a5afcdc2d898e Mon Sep 17 00:00:00 2001 From: water <672684719@qq.com> Date: Fri, 14 Aug 2026 03:48:04 +0800 Subject: [PATCH] fix: handle null from ExtendedSSLSession.getRequestedServerNames (#9523) --- .../kotlin/okhttp3/internal/platform/Platform.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/platform/Platform.kt b/okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/platform/Platform.kt index ffb24d16526f..80eebe3fe94a 100644 --- a/okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/platform/Platform.kt +++ b/okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/platform/Platform.kt @@ -149,7 +149,7 @@ open class Platform { open fun getHandshakeServerNames(sslSocket: SSLSocket): List { val session = sslSocket.session as? ExtendedSSLSession ?: return listOf() return try { - session.requestedServerNames.mapNotNull { (it as? SNIHostName)?.asciiName } + (session.requestedServerNames ?: emptyList()).mapNotNull { (it as? SNIHostName)?.asciiName } } catch (_: UnsupportedOperationException) { // UnsupportedOperationException – if the underlying provider does not implement the operation // https://github.com/bcgit/bc-java/issues/1773