Skip to content

Commit 794657d

Browse files
committed
Fix #640 handle malformed set_enchantments in loot table preview
1 parent fdcb3f2 commit 794657d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/app/components/previews/LootTable.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ const LootFunctions: Record<string, (params: any) => LootFunction> = {
432432
}
433433
},
434434
set_enchantments: ({ enchantments, add }) => (item, ctx) => {
435+
if (typeof enchantments !== 'object' || enchantments === null) {
436+
return
437+
}
435438
if (item.is('book')) {
436439
item.id = Identifier.create('enchanted_book')
437440
item.base = ctx.getBaseComponents(item.id.toString())

0 commit comments

Comments
 (0)