Fix crash when entering a non-numerical value in the probability field

This commit is contained in:
octacian 2017-07-24 10:19:26 -07:00
parent eb0efad188
commit e0941b8f61
1 changed files with 2 additions and 1 deletions

View File

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