Properly check for nil - tonumber will emit it.

This caused a few crashes on people using the creator pad.
This commit is contained in:
Auke Kok 2021-07-09 22:21:52 -07:00
parent 5a9e1286cd
commit 6af528b74f
2 changed files with 2 additions and 2 deletions

View File

@ -631,7 +631,7 @@ do_creator_if = function(player, context)
end end
local pmeta = player:get_meta() local pmeta = player:get_meta()
local limit = tonumber(pmeta:get_string("box_create_limit") or "3") local limit = tonumber(pmeta:get_string("boxxx_create_limit")) or 3
if (minetest.check_player_privs(name, "create") and counts.editing + counts.submitted <= limit) or if (minetest.check_player_privs(name, "create") and counts.editing + counts.submitted <= limit) or
minetest.check_player_privs(name, "review") then minetest.check_player_privs(name, "review") then

View File

@ -74,7 +74,7 @@ function perks.grant(name_or_player)
if accepted >= 3 then if accepted >= 3 then
local pmeta = player:get_meta() local pmeta = player:get_meta()
local limit = tonumber(pmeta:get_string("box_create_limit") or "3") local limit = tonumber(pmeta:get_string("box_create_limit") or 3
if limit <= 3 then if limit <= 3 then
minetest.log("perks: granted more boxes to " .. name) minetest.log("perks: granted more boxes to " .. name)
announce.all(name .. " has been granted the more boxes perk!") announce.all(name .. " has been granted the more boxes perk!")