Fix TasMovie save when TasStateManager is null

This commit is contained in:
Morilli 2024-08-28 02:22:13 +02:00
parent 74dcd81b85
commit 884110e61a
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ namespace BizHawk.Client.Common
private void AddTasProjLumps(ZipStateSaver bs, bool isBackup = false) private void AddTasProjLumps(ZipStateSaver bs, bool isBackup = false)
{ {
var settings = JsonConvert.SerializeObject(TasStateManager.Settings); var settings = JsonConvert.SerializeObject(TasStateManager?.Settings ?? Session.Settings.DefaultTasStateManagerSettings);
bs.PutLump(BinaryStateLump.StateHistorySettings, tw => tw.WriteLine(settings)); bs.PutLump(BinaryStateLump.StateHistorySettings, tw => tw.WriteLine(settings));
bs.PutLump(BinaryStateLump.LagLog, tw => LagLog.Save(tw)); bs.PutLump(BinaryStateLump.LagLog, tw => LagLog.Save(tw));
bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString())); bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString()));
@ -43,7 +43,7 @@ namespace BizHawk.Client.Common
bs.PutLump(BinaryStateLump.Session, tw => tw.WriteLine(JsonConvert.SerializeObject(TasSession))); bs.PutLump(BinaryStateLump.Session, tw => tw.WriteLine(JsonConvert.SerializeObject(TasSession)));
if (!isBackup) if (!isBackup && TasStateManager is not null)
{ {
bs.PutLump(BinaryStateLump.StateHistory, bw => TasStateManager.SaveStateHistory(bw)); bs.PutLump(BinaryStateLump.StateHistory, bw => TasStateManager.SaveStateHistory(bw));
} }