From dec332c8226ef9e82ab592eba1a1fc31cfc1d253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Sat, 7 Dec 2024 15:31:06 +0100 Subject: [PATCH] Treat negative enchantment levels as invalid (#4735) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4735 Reviewed-by: kno10 Co-authored-by: Mikita Wiśniewski Co-committed-by: Mikita Wiśniewski --- mods/ITEMS/mcl_enchanting/engine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index b0f5f2962..c7d0dafea 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -137,7 +137,7 @@ function mcl_enchanting.can_enchant(itemstack, enchantment, level) if not supported then return false, "item not supported" end - if not level then + if not level or level < 0 then return false, "level invalid" end if level > enchantment_def.max_level then