[Genhis][2.0.8] Crash assigning cursor_ghost from one character to another (GameStateAdapter::setGhostCursor)
Posted: Tue Oct 22, 2024 4:16 am
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:
The crash log is attached; at first glance it appears to be a null pointer dereference in GameStateAdapter::setGhostCursor.
To reproduce:
- Create a new world (ctrl+shift+click New Game)
- 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
- The game crashes (not a Lua error)
The crash log is attached; at first glance it appears to be a null pointer dereference in GameStateAdapter::setGhostCursor.