diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-08-19 10:55:04 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-08-19 10:55:04 +0300 |
commit | 0b1ab41a954e2a2b035888e200d775372a3b394e (patch) | |
tree | abc632af931927c2e983b37b17aebe0e3ea60339 /builtin | |
parent | b717b6505b4d401b901d5e07412aa580ff6ec462 (diff) | |
download | minetest-0b1ab41a954e2a2b035888e200d775372a3b394e.tar.gz minetest-0b1ab41a954e2a2b035888e200d775372a3b394e.tar.bz2 minetest-0b1ab41a954e2a2b035888e200d775372a3b394e.zip |
Fix github issue #213: Dropping unknown items crashes the game
The items will now just disappear when dropped.
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/item.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/item.lua b/builtin/item.lua index 4ed20e4f1..4e3c74444 100644 --- a/builtin/item.lua +++ b/builtin/item.lua @@ -227,10 +227,12 @@ function minetest.item_drop(itemstack, dropper, pos) local v = dropper:get_look_dir() local p = {x=pos.x+v.x, y=pos.y+1.5+v.y, z=pos.z+v.z} local obj = minetest.env:add_item(p, itemstack) - v.x = v.x*2 - v.y = v.y*2 + 1 - v.z = v.z*2 - obj:setvelocity(v) + if obj then + v.x = v.x*2 + v.y = v.y*2 + 1 + v.z = v.z*2 + obj:setvelocity(v) + end else minetest.env:add_item(pos, itemstack) end |