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