[2.0.35] Crash after mod error on updating BP in library (SingleBlueprintRecord check fails)

This subforum contains all the issues which we already resolved.
kryojenik
Inserter
Inserter
Posts: 45
Joined: Fri Jun 26, 2020 8:18 pm
Contact:

[2.0.35] Crash after mod error on updating BP in library (SingleBlueprintRecord check fails)

Post by kryojenik »

This is a crash of the factorio binary after an error in a mod crashes the mod / save game.

It specifically happens when attempting to update a blueprint in a players library, and not when attempting to update a blueprint in the game library. While attempting to update the BP in the game library, the mod errors shows. After clicking confirm you are returned to the game load screen.

In the attached save, updating the blueprint in inventory works fine. Updating the blueprint in the game library will crash the running save with a mod error (index local 'bp' (a nil value) and return you to the game load screen. Copy either (or make a new) blueprint in the players personal library and attempt to update that one - you will get the index a nil value error, but will crash the binary to desktop after clicking confirm.

pic

Code: Select all

function on_player_setup_blueprint(e)
  local bp = e.stack
  --[[
  Yes, this is a mod error.  It should be something like:

  local bp = e.stack or e.record
  if not bp then
    return
  end
  
  The mod error should probably not result in the full crash of Factorio, just the the mod
  and running save.
  ]]

  local entities = bp.get_blueprint_entities()
  for _, ent in pairs(entities) do
    game.print(ent.name)
  end
end
Attachments
BP Crash.zip
(1.11 MiB) Downloaded 16 times
factorio-current.log
(12.08 KiB) Downloaded 20 times
testing_1.2.0.zip
Mod with bp.get_blueprint_entities() when bp is nil
(954 Bytes) Downloaded 17 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 15325
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.35] Crash after mod error on updating BP in library (SingleBlueprintRecord check fails)

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 Problems and Bugs”