aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trackplacer.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-10-17 17:42:32 +0200
committerorwell96 <orwell@bleipb.de>2018-10-17 17:42:32 +0200
commit87621caf1f684e66e5b7768859260c7aff66dc6b (patch)
treee4fec54a2e5dfe41b80cc87cc02be4cc3d16a311 /advtrains/trackplacer.lua
parente04d84cb4c137d006587f932b149007bdbe6823a (diff)
downloadadvtrains-87621caf1f684e66e5b7768859260c7aff66dc6b.tar.gz
advtrains-87621caf1f684e66e5b7768859260c7aff66dc6b.tar.bz2
advtrains-87621caf1f684e66e5b7768859260c7aff66dc6b.zip
Fix H#66 (Hemiptera 66) crash on missing double_conn match
Diffstat (limited to 'advtrains/trackplacer.lua')
-rw-r--r--advtrains/trackplacer.lua19
1 files changed, 11 insertions, 8 deletions
diff --git a/advtrains/trackplacer.lua b/advtrains/trackplacer.lua
index ffae736..258c9cd 100644
--- a/advtrains/trackplacer.lua
+++ b/advtrains/trackplacer.lua
@@ -207,15 +207,18 @@ function tp.placetrack(pos, nnpref, placer, itemstack, pointed_thing, yaw)
if (dconn1[conn1.."_"..conn2]) then
using = dconn1[conn1.."_"..conn2]
end
-
- tp.bend_rail(p_railpos[conn1], conn1, nnpref)
- tp.bend_rail(p_railpos[conn2], conn2, nnpref)
- advtrains.ndb.swap_node(pos, using)
- local nname=using.name
- if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then
- minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing)
+ if using then
+ -- has found a fitting rail in either direction
+ -- if not, continue loop
+ tp.bend_rail(p_railpos[conn1], conn1, nnpref)
+ tp.bend_rail(p_railpos[conn2], conn2, nnpref)
+ advtrains.ndb.swap_node(pos, using)
+ local nname=using.name
+ if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then
+ minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing)
+ end
+ return
end
- return
end
end
end