Avoid Exception if array is empty.

This commit is contained in:
Benoit Marty 2020-07-01 09:48:03 +02:00
parent 73ce38c6a9
commit f86fa6cb5d
1 changed files with 2 additions and 2 deletions

View File

@ -239,12 +239,12 @@ internal object CertUtil {
fun newConnectionSpecs(hsConfig: HomeServerConnectionConfig): List<ConnectionSpec> { fun newConnectionSpecs(hsConfig: HomeServerConnectionConfig): List<ConnectionSpec> {
val builder = ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) val builder = ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
val tlsVersions = hsConfig.tlsVersions val tlsVersions = hsConfig.tlsVersions
if (null != tlsVersions) { if (null != tlsVersions && tlsVersions.isNotEmpty()) {
builder.tlsVersions(*tlsVersions.toTypedArray()) builder.tlsVersions(*tlsVersions.toTypedArray())
} }
val tlsCipherSuites = hsConfig.tlsCipherSuites val tlsCipherSuites = hsConfig.tlsCipherSuites
if (null != tlsCipherSuites) { if (null != tlsCipherSuites && tlsCipherSuites.isNotEmpty()) {
builder.cipherSuites(*tlsCipherSuites.toTypedArray()) builder.cipherSuites(*tlsCipherSuites.toTypedArray())
} }