Check for NaN values in settings

This commit is contained in:
upsilon
2017-02-11 15:44:53 +01:00
parent d6e50086c1
commit 676baa4b0b
7 changed files with 24 additions and 8 deletions

View File

@ -117,6 +117,8 @@ function is_jammed(pos)
local JAMMER_MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_wireless.jammer_max_distance")) or 15
if JAMMER_MAX_DISTANCE <= 0 then
JAMMER_MAX_DISTANCE = 1
elseif JAMMER_MAX_DISTANCE ~= JAMMER_MAX_DISTANCE then -- NaN
JAMMER_MAX_DISTANCE = 15
end
local pz,py,px = vector.unpack(pos)