mirror of
git://repo.or.cz/minetest_schemedit.git
synced 2025-01-09 17:40: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
|
fields.key_enter_field == "probability" then
|
||||||
if fields.probability ~= "" then
|
if fields.probability ~= "" then
|
||||||
local prob = tonumber(fields.probability)
|
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)
|
smeta:set_string("advschem_prob", fields.probability)
|
||||||
else
|
else
|
||||||
advschem.show_formspec(pos, minetest.get_player_by_name(name), "prob")
|
advschem.show_formspec(pos, minetest.get_player_by_name(name), "prob")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
smeta:set_string("advschem_prob", nil)
|
smeta:set_string("advschem_prob", nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user