summaryrefslogtreecommitdiff
path: root/item_transport.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-06-23 12:24:35 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-06-23 12:48:20 -0400
commitd0952a97fcff08328328d05f630d2b0036a48163 (patch)
tree671699a26e5f46c73b56d5eb8756abee466f3ed4 /item_transport.lua
parent5822f60ba9cbebe45c1f82fa06dc93b747ba71a6 (diff)
downloadpipeworks-d0952a97fcff08328328d05f630d2b0036a48163.tar
pipeworks-d0952a97fcff08328328d05f630d2b0036a48163.tar.gz
pipeworks-d0952a97fcff08328328d05f630d2b0036a48163.tar.bz2
pipeworks-d0952a97fcff08328328d05f630d2b0036a48163.tar.xz
pipeworks-d0952a97fcff08328328d05f630d2b0036a48163.zip
fix multiple crash points if luaentity.entities or values returned from
luaentity.add_entity() are nil
Diffstat (limited to 'item_transport.lua')
-rw-r--r--item_transport.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/item_transport.lua b/item_transport.lua
index fb9f626..7b64e7a 100644
--- a/item_transport.lua
+++ b/item_transport.lua
@@ -6,6 +6,7 @@ function pipeworks.tube_inject_item(pos, start_pos, velocity, item)
-- Take item in any format
local stack = ItemStack(item)
local obj = luaentity.add_entity(pos, "pipeworks:tubed_item")
+ if not obj then return end
obj:set_item(stack:to_string())
obj.start_pos = vector.new(start_pos)
obj:setvelocity(velocity)