From 0c2f1d2e8582682890702c0267619416053e00eb Mon Sep 17 00:00:00 2001 From: Brady Svedin Date: Mon, 4 Nov 2024 10:42:33 -0700 Subject: [PATCH] Better DataClassPathSerializer errors --- .../com/lightningkite/serialization/DataClassPathSerializer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/commonMain/kotlin/com/lightningkite/serialization/DataClassPathSerializer.kt b/shared/src/commonMain/kotlin/com/lightningkite/serialization/DataClassPathSerializer.kt index c6bfed5d..37397bc5 100644 --- a/shared/src/commonMain/kotlin/com/lightningkite/serialization/DataClassPathSerializer.kt +++ b/shared/src/commonMain/kotlin/com/lightningkite/serialization/DataClassPathSerializer.kt @@ -77,7 +77,7 @@ class DataClassPathSerializer(val inner: KSerializer): KSerializerWithDefa if(part.endsWith('?') || prop.serializer.descriptor.isNullable && index != valueParts.lastIndex) { @Suppress("UNCHECKED_CAST") current = DataClassPathNotNull(current as DataClassPath) - currentSerializer = currentSerializer.nullElement()!! + currentSerializer = currentSerializer.nullElement() ?: throw SerializationException("${prop.name} is not nullable") } }