Patch Description
This patch fixes a non-recoverable crash in Belt Balancer 2 v2.0.9 caused by invalid LuaTransportLine references.
When belts connected to an active balancer are removed, rotated, upgraded, or blueprint-replaced, some internal transport line references become invalid. The original script attempted to access these invalid lines during its periodic update, causing Factorio to throw a fatal error and stop the game.
What was changed
Added lane.valid checks before accessing any LuaTransportLine
Prevents calls to #lane, lane[1], or lane.remove_item() on invalid transport lines
Invalid lanes are now safely skipped instead of crashing the script
Result
Eliminates the LuaTransportLine API call when LuaTransportLine was invalid error
Prevents non-recoverable crashes during belt modifications
Gameplay behavior remains unchanged for valid belts
This is a stability-only fix intended for private use so multiplayer games can continue without crashes.
All credit for the original mod goes to the original author.
Please refer to: https://mods.factorio.com/mod/belt-balancer-2