From 794657d0f525329e1f1553ea25a61bfd191e27b9 Mon Sep 17 00:00:00 2001 From: Misode Date: Wed, 27 Nov 2024 21:40:39 +0100 Subject: [PATCH] Fix #640 handle malformed set_enchantments in loot table preview --- src/app/components/previews/LootTable.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/components/previews/LootTable.ts b/src/app/components/previews/LootTable.ts index 9cdcbb5c..d1c3e909 100644 --- a/src/app/components/previews/LootTable.ts +++ b/src/app/components/previews/LootTable.ts @@ -432,6 +432,9 @@ const LootFunctions: Record LootFunction> = { } }, set_enchantments: ({ enchantments, add }) => (item, ctx) => { + if (typeof enchantments !== 'object' || enchantments === null) { + return + } if (item.is('book')) { item.id = Identifier.create('enchanted_book') item.base = ctx.getBaseComponents(item.id.toString())