projects
/
oweals
/
minetest_game.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1fa8180
)
Prevent crash if some mod inadvertently allowed doors to rotate
author
sofar
<sofar+github@foo-projects.org>
Thu, 6 Dec 2018 23:29:43 +0000
(15:29 -0800)
committer
Paramat
<paramat@users.noreply.github.com>
Thu, 6 Dec 2018 23:29:43 +0000
(23:29 +0000)
mods/doors/init.lua
patch
|
blob
|
history
diff --git
a/mods/doors/init.lua
b/mods/doors/init.lua
index 2685357ad51736e78a91448489c231ebfe2db1d9..789bbb0c659f2b327d8a128baaea4ef4de6a45eb 100644
(file)
--- a/
mods/doors/init.lua
+++ b/
mods/doors/init.lua
@@
-162,6
+162,14
@@
function _doors.door_toggle(pos, node, clicker)
end
local dir = node.param2
+
+ -- It's possible param2 is messed up, so, validate before using
+ -- the input data. This indicates something may have rotated
+ -- the door, even though that is not supported.
+ if not transform[state + 1] or not transform[state + 1][dir + 1] then
+ return false
+ end
+
if state % 2 == 0 then
minetest.sound_play(def.door.sounds[1],
{pos = pos, gain = 0.3, max_hear_distance = 10})