aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking
diff options
context:
space:
mode:
author1F616EMO <root@1f616emo.xyz>2024-09-29 06:43:27 +0800
committerorwell <orwell@bleipb.de>2024-11-09 22:16:39 +0100
commit8b9eb2a96d9c1c425ff9014fdf27c82526d8376b (patch)
treef697ce7862f1ee36acdc14ba65732c04973d01a6 /advtrains_interlocking
parente53670904127c8493e13b587e507407f2beac8b3 (diff)
downloadadvtrains-8b9eb2a96d9c1c425ff9014fdf27c82526d8376b.tar.gz
advtrains-8b9eb2a96d9c1c425ff9014fdf27c82526d8376b.tar.bz2
advtrains-8b9eb2a96d9c1c425ff9014fdf27c82526d8376b.zip
Fix update_route receiving invalid route ID in after()
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r--advtrains_interlocking/routesetting.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index 381fa26..fd6d595 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -292,7 +292,13 @@ function ilrs.update_route(sigd, tcbs, newrte, cancel)
end
if newrte then tcbs.routeset = newrte end
--atdebug("Setting:",tcbs.routeset)
- local succ, rsn, cbts, cblk = ilrs.set_route(sigd, tcbs.routes[tcbs.routeset])
+ local succ, rsn, cbts, cblk
+ if tcbs.routes[tcbs.routeset] then
+ succ, rsn, cbts, cblk = ilrs.set_route(sigd, tcbs.routes[tcbs.routeset])
+ else
+ succ = false
+ rsn = attrans("Route state changed.")
+ end
if not succ then
tcbs.route_rsn = rsn
--atdebug("Routesetting failed:",rsn)