From 9e115196089abeab9e34aba08c0414b2afa1908d Mon Sep 17 00:00:00 2001 From: sergeych Date: Sat, 13 Dec 2025 23:11:28 +0100 Subject: [PATCH] revert to wirking ugly fix for decodeClassObj --- .../kotlin/net/sergeych/lynon/LynonDecoder.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lynglib/src/commonMain/kotlin/net/sergeych/lynon/LynonDecoder.kt b/lynglib/src/commonMain/kotlin/net/sergeych/lynon/LynonDecoder.kt index 6e230d1..8e99d2d 100644 --- a/lynglib/src/commonMain/kotlin/net/sergeych/lynon/LynonDecoder.kt +++ b/lynglib/src/commonMain/kotlin/net/sergeych/lynon/LynonDecoder.kt @@ -82,11 +82,14 @@ open class LynonDecoder(val bin: BitInput, val settings: LynonSettings = LynonSe if (it !is ObjClass) scope.raiseClassCastError("Expected obj class but got ${it::class.simpleName}") it - } ?: scope.also { - println("Class not found: $className") - println("::: ${runCatching { scope.eval("Vault")}.getOrNull() }") - println("::2 [${className}]: ${scope.get(className.value)}") - }.raiseSymbolNotFound("can't deserialize: not found type $className") + } ?: run { + val fallback = runCatching { scope.eval(className.value) }.getOrNull() + if (fallback != null) { + println("Fallback to eval successful") + fallback as ObjClass + } + else scope.raiseSymbolNotFound("can't deserialize: not found type $className") + } } suspend fun decodeAnyList(scope: Scope, fixedSize: Int? = null): MutableList {