aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2016-12-21 07:10:32 +0000
committerparamat <mat.gregory@virginmedia.com>2016-12-21 13:30:10 +0000
commit5e4d6468a3110d8879e80e51490c0717ce64d75c (patch)
tree282b5f38e6ca94b6ea5a618da93c434ed0e2a1cd /builtin
parentba52a34f94504e966ee3842e724561eec037cbc0 (diff)
downloadminetest-5e4d6468a3110d8879e80e51490c0717ce64d75c.tar.gz
minetest-5e4d6468a3110d8879e80e51490c0717ce64d75c.tar.bz2
minetest-5e4d6468a3110d8879e80e51490c0717ce64d75c.zip
Builtin/../falling.lua: Avoid crash when object pos over limit
If the object pos is over limit, 'add entity' will not add an entity, causing 'obj' to be nil.
Diffstat (limited to 'builtin')
-rw-r--r--builtin/game/falling.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index 8b88b68d8..4696ce481 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -113,7 +113,9 @@ core.register_entity(":__builtin:falling_node", {
local function spawn_falling_node(p, node)
local obj = core.add_entity(p, "__builtin:falling_node")
- obj:get_luaentity():set_node(node)
+ if obj then
+ obj:get_luaentity():set_node(node)
+ end
end
local function drop_attached_node(p)