Mod author for Quality Control here, I checked into what was happening as I definitely want to support accessibility mods. Any mod that updates runtime settings could trigger this error for Transport Belt Direction Indicator.
Details:
Mod's can raise on_runtime_mod_setting_changed without a player_index. The Transport Belt handler receives this event and calls game.get_player(nil) at line 25, causing the crash. Factorio documents player_index as optional for this event.
Fix:
You could check the player_index property, or could filter the settings handler to "belt-direction-indicator. Or both:
Filter:
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if event.setting ~= "belt-direction-indicator" then
return
end
belt_direction_indicator(event)
end)
Optional guard if you don't want to filter events:
local player_index = event.player_index
if not player_index then
return
end
local player = game.get_player(player_index)
if not player then
return
end