Skip to content

Commit

Permalink
Put a try/catch around savefile flushing on shutdown (OpenDreamProjec…
Browse files Browse the repository at this point in the history
  • Loading branch information
wixoaGit authored Dec 26, 2023
1 parent 562f047 commit 2f97f7c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion OpenDreamRuntime/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public override void PostInit() {
protected override void Dispose(bool disposing) {
// Write every savefile to disk
foreach (var savefile in DreamObjectSavefile.Savefiles.ToArray()) { //ToArray() to avoid modifying the collection while iterating over it
savefile.Close();
try {
savefile.Close();
} catch (Exception e) {
Logger.GetSawmill("opendream").Error($"Exception while flushing savefile '{savefile.Resource.ResourcePath}', data has been lost. {e}");
}
}

_dreamManager.Shutdown();
Expand Down

0 comments on commit 2f97f7c

Please sign in to comment.