projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b717b65
)
Fix github issue #213: Dropping unknown items crashes the game
author
Perttu Ahola
<celeron55@gmail.com>
Sun, 19 Aug 2012 07:55:04 +0000
(10:55 +0300)
committer
Perttu Ahola
<celeron55@gmail.com>
Sun, 19 Aug 2012 07:55:04 +0000
(10:55 +0300)
The items will now just disappear when dropped.
builtin/item.lua
patch
|
blob
|
history
diff --git
a/builtin/item.lua
b/builtin/item.lua
index 4ed20e4f1a2133f24a1513dd35a22b74eb5b896c..4e3c74444d18374f2ddf02e49e4d31f304b529bc 100644
(file)
--- 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