diff options
author | orwell96 <orwell@bleipb.de> | 2019-02-06 23:22:48 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2019-02-06 23:22:48 +0100 |
commit | 2d2cd9605b91ec2f8ec2320714d7a263db50d009 (patch) | |
tree | bdfa24ca07e5530a20dab33973a616d7f730b818 /advtrains/occupation.lua | |
parent | 392adc838dc1b6009247eee36491ddd18f081555 (diff) | |
download | advtrains-2d2cd9605b91ec2f8ec2320714d7a263db50d009.tar.gz advtrains-2d2cd9605b91ec2f8ec2320714d7a263db50d009.tar.bz2 advtrains-2d2cd9605b91ec2f8ec2320714d7a263db50d009.zip |
No crash when train does not exist on check_collision()
Diffstat (limited to 'advtrains/occupation.lua')
-rw-r--r-- | advtrains/occupation.lua | 3 |
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 |