From 911394aa5e01401528a6c48f59f5618352d18605 Mon Sep 17 00:00:00 2001 From: Danielle Voznyy Date: Thu, 25 Jan 2024 23:33:02 -0500 Subject: [PATCH] Fix: Correctly throw error when failed to reload prefab --- .../kotlin/com/mineinabyss/geary/prefabs/PrefabLoader.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/geary-prefabs/src/commonMain/kotlin/com/mineinabyss/geary/prefabs/PrefabLoader.kt b/addons/geary-prefabs/src/commonMain/kotlin/com/mineinabyss/geary/prefabs/PrefabLoader.kt index 8cb7c7b7..9e6a994d 100644 --- a/addons/geary-prefabs/src/commonMain/kotlin/com/mineinabyss/geary/prefabs/PrefabLoader.kt +++ b/addons/geary-prefabs/src/commonMain/kotlin/com/mineinabyss/geary/prefabs/PrefabLoader.kt @@ -59,7 +59,6 @@ class PrefabLoader { formats[ext]?.decodeFromFile(serializer, path) ?: throw IllegalArgumentException("Unknown file format $ext") } - // Stop here if we need to make a new entity // For existing prefabs, add all tags except decoded on fail to keep them tracked if (writeTo == null && decoded.isFailure) decoded.getOrThrow() @@ -71,6 +70,7 @@ class PrefabLoader { entity.set(Prefab(path)) decoded.getOrNull()?.let { entity.setAll(it) } entity.set(key) + decoded.getOrThrow() return entity }