Calling entity.get_filter() on a logistic container that is not of
storage type throws and kills the whole multiplayer server.
Error:
Error while running event FilterHelper::on_gui_opened (ID 104)
Given logistic container isn't a storage type.
FilterHelper/filter_updaters.lua:219: in function 'get_active_items'
FilterHelper/control.lua:597: in function 'update_ui'
FilterHelper/control.lua:646
MultiplayerManager failed: "The mod Filter Helper (0.2.29)
caused a non-recoverable error."
Changing state from(InGame) to(Failed)
Reproduction:
1. Install FilterHelper 0.2.29 together with cargo-bay-inserters
(or any mod that adds a logistic container which is not storage type)
2. Host a multiplayer game
3. Open the GUI of that custom logistic container
4. Server crashes, everybody disconnects
Cause:
filter_updaters.lua calls entity.get_filter() unconditionally.
The one_filter_updater condition only excludes infinity-container:
return entity.filter_slot_count == 1
and fh_util.get_effective_type(entity) ~= "infinity-container"
Custom logistic containers can have filter_slot_count == 1 while
still not supporting get_filter().
Affected lines: 219, 261, 268, 285
Suggested fix: wrap the calls, e.g.
local ok, filter = pcall(entity.get_filter, entity, 1)
if not ok then return {} end
or check entity.type first.
Tested on: Factorio 2.1.24 (build 87808).
With pcall guards applied the crash is gone.