Skip to content


Browse files Browse the repository at this point in the history
Return if invalid parameters are given to node_detector_scan (e.g. un…
…loaded area), should fix #228
  • Loading branch information
Jeija committed Mar 26, 2015
1 parent a6d0a52 commit b6ae419
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mesecons_detector/init.lua
Expand Up @@ -135,8 +135,12 @@ end

-- returns true if player was found, false if not
local node_detector_scan = function (pos)
local node = minetest.get_node(pos)
local frontpos = vector.subtract(pos, minetest.facedir_to_dir(node.param2))
if not pos then return end
local node = minetest.get_node_or_nil(pos)
if not node then return end

This comment has been minimized.

Copy link

sfan5 Mar 26, 2015


This if should be enough, all other conditions (pos == nil or minetest.facedir_to_dir(node.param2) == nil) are caused by other bugs in the code which should be fixed instead of having a check here,

local scandir = minetest.facedir_to_dir(node.param2)
if not scandir then return end
local frontpos = vector.subtract(pos, scandir)
local frontnode = minetest.get_node(frontpos)
local meta = minetest.get_meta(pos)
return ( == meta:get_string("scanname")) or
Expand Down

0 comments on commit b6ae419

Please sign in to comment.