[2.1.9] Crash calling transfer_from_stack on item-on-ground

Bugs which we just recently fixed in our development version and will reach you in the next release.
OhSnap
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Sep 06, 2025 6:47 pm
Contact:

[2.1.9] Crash calling transfer_from_stack on item-on-ground

Post by OhSnap »

Create a mod that adds the following command and execute it twice:

Code: Select all

commands.add_command("test_game_crash", nil, function(command)
    -- NOTE: Does not crash and removes the item-on-ground if transfer_from_stack is called immediately after entity creation
    local buggy = game.surfaces["nauvis"].find_entity("item-on-ground", {0, 0})
    if buggy then
        local inv_1 = game.create_inventory(10)
        inv_1.transfer_from_stack(buggy.stack)
        game.print(buggy.gps_tag..": Hover me to crash the game")
    else
        buggy = game.surfaces["nauvis"].create_entity {
            name = "item-on-ground",
            position = {0, 0},
            stack = { name = "iron-plate", count = 1 }
        }
        buggy.order_deconstruction(game.forces.player)
    end
end)
Result:
The item-on-ground is still shown as marked for deconstruction, but the iron-plate sprite is gone. When hovering over it with the mouse, the game crashes.

In my actual scenario where this happened, I can call buggy.stack.clear() sometimes to avoid the crash, but this does not reproduce in this test code (will produce a "LuaEntity was invalid" error instead and not crash)
Attachments
factorio-current.log
(12.61 KiB) Downloaded 9 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 17134
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.9] Crash calling transfer_from_stack on item-on-ground

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.
Post Reply

Return to “Resolved for the next release”