Treat negative enchantment levels as invalid (#4735)

Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4735
Reviewed-by: kno10 <kno10@noreply.git.minetest.land>
Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
This commit is contained in:
Mikita Wiśniewski 2024-12-07 15:31:06 +01:00 committed by the-real-herowl
parent e42a863d92
commit dec332c822

View file

@ -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