Skip to content

Crash loading run from before mod install #3

@oorzkws

Description

@oorzkws

Hitting continue on a run I started before installing DVHistory crashes the game. Seems it's looking for data in the save that may not exist.

Crash:

INFO - [G] 2025-01-08 14:58:26 :: ERROR :: StackTrace :: Oops! The game crashed
globals.lua:629: attempt to index field 'DV' (a nil value)
Stack Traceback
===============
(1) Lua local 'handler' at file 'main.lua:612'
	Local variables:
	 msg = string: "globals.lua:629: attempt to index field 'DV' (a nil value)"
	 (*temporary) = Lua function '?' (defined at line 31 of chunk [SMODS _ "src/logging.lua"])
	 (*temporary) = string: "Oops! The game crashed\

Trace source:

DV.HIST._start_run = Game.start_run
function Game:start_run(args)
   DV.HIST._start_run(self, args)

   if not args or not args.savetext then
      -- New run, so modify `GAME` table with custom storage:
      if not G.GAME.DV then G.GAME.DV = {} end
      G.GAME.DV.run_id = DV.HIST.simple_uuid()

      -- ...and reset mod data:
      DV.HIST.history = {}
      DV.HIST.latest = {
         rel_round = 0,
         abs_round = 0,
         ante = 0,
      }
   else
      -- Loaded run, so extract mod data from loaded data:
      DV.HIST.history = G.GAME.DV.history
      DV.HIST.latest = G.GAME.DV.latest
   end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions