mirror of
git://repo.or.cz/minetest_schemedit.git
synced 2025-01-09 09:30:32 +01:00
Fix crash when entering a non-numerical value in the probability field
This commit is contained in:
parent
eb0efad188
commit
e0941b8f61
3
init.lua
3
init.lua
@ -318,10 +318,11 @@ advschem.add_form("prob", {
|
||||
fields.key_enter_field == "probability" then
|
||||
if fields.probability ~= "" then
|
||||
local prob = tonumber(fields.probability)
|
||||
if prob >= 0 and prob <= 255 then
|
||||
if prob and prob >= 0 and prob <= 255 then
|
||||
smeta:set_string("advschem_prob", fields.probability)
|
||||
else
|
||||
advschem.show_formspec(pos, minetest.get_player_by_name(name), "prob")
|
||||
return
|
||||
end
|
||||
else
|
||||
smeta:set_string("advschem_prob", nil)
|
||||
|
Loading…
Reference in New Issue
Block a user