From 97ec41a657a92d2b99a76d276812c5f4d02b7ad1 Mon Sep 17 00:00:00 2001 From: Andreas Tschabuschnig Date: Tue, 21 Jan 2025 11:02:34 +0800 Subject: [PATCH] fix(credentials) #145: NPE on unknown version --- .../modules/credentials/services/CredentialsClientService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocpi-toolkit-2.2.1/src/main/kotlin/com/izivia/ocpi/toolkit/modules/credentials/services/CredentialsClientService.kt b/ocpi-toolkit-2.2.1/src/main/kotlin/com/izivia/ocpi/toolkit/modules/credentials/services/CredentialsClientService.kt index a92a0375..024242ae 100644 --- a/ocpi-toolkit-2.2.1/src/main/kotlin/com/izivia/ocpi/toolkit/modules/credentials/services/CredentialsClientService.kt +++ b/ocpi-toolkit-2.2.1/src/main/kotlin/com/izivia/ocpi/toolkit/modules/credentials/services/CredentialsClientService.kt @@ -205,7 +205,7 @@ open class CredentialsClientService( // Get available versions and pick latest mutual val latestMutualVersion = availableServerVersions - .sortedByDescending { clientVersion -> parseVersionNumber(clientVersion.version)!!.index } + .sortedByDescending { clientVersion -> parseVersionNumber(clientVersion.version)?.index ?: 0 } .firstOrNull { serverVersion -> availableClientVersionNumbers .any { clientVersionNumber -> serverVersion.version == clientVersionNumber.value }