Skip to content

Commit

Permalink
catch exceptions when patching usmap
Browse files Browse the repository at this point in the history
  • Loading branch information
atenfyr committed Jan 19, 2025
1 parent d30d1a4 commit 79c0df7
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions UAssetGUI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2069,14 +2069,25 @@ private void patchusmapWithsavVersionInfoToolStripMenuItem_Click(object sender,

if (inPath == null) return;

bool success = true;
Stopwatch timer = new Stopwatch();
timer.Start();
var thing = new SaveGame(inPath);
thing.PatchUsmap(patchPath);
timer.Stop();
UpdateMappings();

MessageBox.Show("Operation completed in " + timer.ElapsedMilliseconds + " ms.", this.Text);
try
{
var thing = new SaveGame(inPath);
thing.PatchUsmap(patchPath);
}
catch (Exception ex)
{
MessageBox.Show("Failed to patch mappings! " + ex.GetType() + ": " + ex.Message, "Uh oh!");
success = false;
}
finally
{
timer.Stop();
UpdateMappings();
if (success) MessageBox.Show("Operation completed in " + timer.ElapsedMilliseconds + " ms.", this.Text);
}
});
}

Expand Down

0 comments on commit 79c0df7

Please sign in to comment.