[Genhis][2.0.8] Crash assigning cursor_ghost from one character to another (GameStateAdapter::setGhostCursor)

This subforum contains all the issues which we already resolved.
User avatar
Penguin_Spy
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Feb 26, 2017 3:09 am
Contact:

[Genhis][2.0.8] Crash assigning cursor_ghost from one character to another (GameStateAdapter::setGhostCursor)

Post by Penguin_Spy »

Using Lua, if you read the cursor_ghost field of a character entity, assigning that value to another character entity's cursor_ghost field crashes the game. No item actually needs to be in the cursor ghost, nor does the character need to be currently controlled by a player (the game will also crash if there is an item).
To reproduce:
  1. Create a new world (ctrl+shift+click New Game)
  2. Run the following commands:

    Code: Select all

    -- create a new player (run twice so it actually happens)
    /c character = game.player.surface.create_entity{name="character", position={0,2}}
    
    -- read the value of your player's cursor_ghost field
    /c ghost = game.player.character.cursor_ghost
    
    -- assign the cursor_ghost value to another character's cursor_ghost field
    /c character.cursor_ghost = ghost
    
  3. The game crashes (not a Lua error)
The expected result would be that the contents of the ghost cursor are copied correctly, but if I'm reading the docs wrong a Lua error related to assigning the wrong kind of value would also make sense.

The crash log is attached; at first glance it appears to be a null pointer dereference in GameStateAdapter::setGhostCursor.
factorio-current.log
(20.11 KiB) Downloaded 23 times
I exist.
Genhis
Factorio Staff
Factorio Staff
Posts: 709
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis][2.0.8] Crash assigning cursor_ghost from one character to another (GameStateAdapter::setGhostCursor)

Post by Genhis »

Thanks, the issue is fixed for the next release.
Post Reply

Return to “Resolved Problems and Bugs”