aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-02-06 23:22:48 +0100
committerorwell96 <orwell@bleipb.de>2019-02-06 23:22:48 +0100
commit2d2cd9605b91ec2f8ec2320714d7a263db50d009 (patch)
treebdfa24ca07e5530a20dab33973a616d7f730b818
parent392adc838dc1b6009247eee36491ddd18f081555 (diff)
downloadadvtrains-2d2cd9605b91ec2f8ec2320714d7a263db50d009.tar.gz
advtrains-2d2cd9605b91ec2f8ec2320714d7a263db50d009.tar.bz2
advtrains-2d2cd9605b91ec2f8ec2320714d7a263db50d009.zip
No crash when train does not exist on check_collision()
-rw-r--r--advtrains/occupation.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/advtrains/occupation.lua b/advtrains/occupation.lua
index 6e14459..66a5a75 100644
--- a/advtrains/occupation.lua
+++ b/advtrains/occupation.lua
@@ -172,8 +172,9 @@ function o.check_collision(pos, train_id)
if ti~=train_id then
local idx = t[i+1]
local train = advtrains.trains[ti]
+
--atdebug("checking train",t[i],"index",idx,"<>",train.index,train.end_index)
- if idx >= train.end_index and idx <= train.index then
+ if train and idx >= train.end_index and idx <= train.index then
--atdebug("collides.")
return true
end