Quezler/glutenfree

attempt to index field 'entangled' (a nil value)

bwochinski opened this issue · 1 comments

Not sure of what changed that caused this but in about the last week attempting to load a save (that had preivously worked fine) resulted in a crash:

The mod LTN - Logistic Train Network (1.17.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event LogisticTrainNetwork::on_configuration_changed
The mod Glutenfree LTN announcer (1.0.12) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event glutenfree-ltn-announcer::on_train_schedule_changed (ID 113)
glutenfree-ltn-announcer/scripts/train.lua:48: attempt to index field 'entangled' (a nil value)
stack traceback:
glutenfree-ltn-announcer/scripts/train.lua:48: in function 'entangled_with_stations'
glutenfree-ltn-announcer/scripts/speaker.lua:129: in function <glutenfree-ltn-announcer/scripts/speaker.lua:117>
stack traceback:
[C]: in function '__newindex'
LogisticTrainNetwork/script/train-events.lua:114: in function 'TrainArrives'
LogisticTrainNetwork/script/init.lua:243: in function 'updateAllTrains'
LogisticTrainNetwork/script/init.lua:337: in function <LogisticTrainNetwork/script/init.lua:313>

My lua is rusty but was able to get things to load by tossing a check for 'nil' in where that was happening.

Inserted in train.lua @ line:47
if global.entangled == nil then return {} end

This occurred in an SE / Krastorio2 save with quite a few mods, but the only that deal with trains & LTN are:

LTN - Logistic Train Network
LTN Combinator Modernized
LTN Manager
Glutenfree LTN Announcer
Better Temporary Train Stops

ah yes, this is something completely bizarre, LTN's init/load/configuration_changed causes it to fire events for my mod before it had a chance to initialize, i already took care of this issue in another place, but apparently i had missed this one.