minetest-mods / castle_gates

Large swinging and sliding gate components suitable for a castle
MIT License
9 stars 8 forks source link

fix crash when gate got deleted while it's moving #22

Closed Niklp09 closed 1 year ago

Niklp09 commented 1 year ago

Fixes https://github.com/Archtec-io/bugtracker/issues/33 and https://github.com/minetest-mods/castle_gates/issues/17

2023-04-26 19:25:14: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'default' in callback environment_Step(): ...netest-5.7.0/bin/../mods/castle_gates/gate_functions.lua:441: attempt to index a nil value
2023-04-26 19:25:14: ERROR[Main]: stack traceback:
2023-04-26 19:25:14: ERROR[Main]:   ...netest-5.7.0/bin/../mods/castle_gates/gate_functions.lua:441: in function 'func'
2023-04-26 19:25:14: ERROR[Main]:   .../minetest/minetest-5.7.0/bin/../builtin/common/after.lua:20: in function <.../minetest/minetest-5.7.0/bin/../builtin/common/after.lua:5>
2023-04-26 19:25:14: ERROR[Main]:   ...minetest/minetest-5.7.0/bin/../builtin/game/register.lua:446: in function <...minetest/minetest-5.7.0/bin/../builtin/game/register.lua:432>

and a second crash

2023-04-27 20:18:12: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'castle_gates' in callback item_OnPlace(): ...ik/mt-server/bin/../mods/castle_gates/gate_functions.lua:217: attempt to index local 'adjacent_def' (a nil value)
2023-04-27 20:18:12: ERROR[Main]: stack traceback:
2023-04-27 20:18:12: ERROR[Main]:       ...ik/mt-server/bin/../mods/castle_gates/gate_functions.lua:217: in function 'get_door_layout'
2023-04-27 20:18:12: ERROR[Main]:       ...ik/mt-server/bin/../mods/castle_gates/gate_functions.lua:375: in function 'on_rightclick'
2023-04-27 20:18:12: ERROR[Main]:       /home/nik/mt-server/bin/../builtin/game/item.lua:313: in function </home/nik/mt-server/bin/../builtin/game/item.lua:306>
SmallJoker commented 1 year ago

This is an error, not a crash. Reviewed the PR ignoring whitespace changes; looks good.