[2.0.28] Error when setting storage_filter to nil on storage chests

This subforum contains all the issues which we already resolved.
Daschi
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Nov 22, 2024 9:17 pm
Contact:

[2.0.28] Error when setting storage_filter to nil on storage chests

Post by Daschi »

What did you do?
I attempted to clear the storage_filter of a storage chest in my mod by setting the storage_filter property to nil. This was done using the following code:

Code: Select all

script.on_event(prototypes.custom_input["automatic-logistic-chests-refresh-selected-logistic-chest"], function(event)
    local player = game.players[event.player_index]
    local chest = player.selected

    if chest and chest.valid and chest.prototype.logistic_mode == "storage" then
        chest.storage_filter = nil
    end
end)
To reproduce:
1. Hover over a storage chest in-game.
2. Press the shortcut key defined in the mod to trigger the script above.

What happened?
When executing the code, the game produced the following error:

Code: Select all

value for required parameter 1 (item-with-quality-id) is missing
This error occurred regardless of whether the chest currently had a filter set or not.

What did you expect to happen instead?
I expected the storage_filter property to accept nil and clear the filter on the storage chest without causing an error. This expectation aligns with the documentation for the storage_filter property, which indicates it is nullable.

Does it happen always, once, or sometimes?
This issue occurs consistently every time the code is executed.

Additional Context
The storage_filter documentation (https://lua-api.factorio.com/latest/cla ... age_filter) indicates that this property is nullable, and reading the storage_filter property of a chest without a filter correctly returns nil.

Attachments
Rseding91
Factorio Staff
Factorio Staff
Posts: 14816
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.28] Error when setting storage_filter to nil on storage chests

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Daschi
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Nov 22, 2024 9:17 pm
Contact:

Re: [2.0.28] Error when setting storage_filter to nil on storage chests

Post by Daschi »

Awesome, thank you for the quick fix!
Post Reply

Return to “Resolved Problems and Bugs”