Page 1 of 1

[Genhis][2.0.8] Crash accessing opened field of character in cutscene

Posted: Tue Oct 22, 2024 7:28 am
by Penguin_Spy
Using Lua, if you access the opened field of a character entity while that character is attached to a player and that player is watching a cutscene, the game crashes.
To reproduce:
  1. Create a new world through the Freeplay scenario (to use the crash site cutscene)
  2. While watching the cutscene, run the following command:

    Code: Select all

    /c game.player.print(game.player.cutscene_character.opened)
    
  3. The game crashes (not a Lua error)
The following code also causes the same crash, so the error is not unique to the Freeplay scenario or the cutscene_character field:

Code: Select all

-- save the character entity
/c character = game.player.character
-- start a 7 second cutscene
/c game.player.set_controller{type=defines.controllers.cutscene, waypoints={{position={0,-10},transition_time=300,time_to_wait=120}}}
-- access the character's opened field (using game.print so parses as valid Lua)
/c game.print(character.opened)
The expected result would be reading a value of nil (as I'm pretty no GUI should be open during a cutscene).

The crash log is attached; at first glance it appears to be a null pointer dereference in GameStateAdapter::getGuiTarget.
factorio-current.log
(20.13 KiB) Downloaded 21 times

Re: [Genhis][2.0.8] Crash accessing opened field of character in cutscene

Posted: Tue Oct 22, 2024 2:51 pm
by Genhis
Thanks for the report and for providing easy reproduction steps - issues get fixed a lot quicker if I can just copy a few commands and see it crash. :) It's now fixed for the next release.