Skip to content

Commit

Permalink
Error handling for textdata_en
Browse files Browse the repository at this point in the history
  • Loading branch information
Grossley committed Mar 3, 2021
1 parent 6d3bcc3 commit ffe4496
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,20 @@ private void UpdateGettext(UndertaleCode gettextCode)
{
Match m = Regex.Match(line, "^ds_map_add\\(global.text_data_en, \"(.*)\"@([0-9]+), \"(.*)\"@([0-9]+)\\)");
if (m.Success)
gettext.Add(m.Groups[1].Value, Int32.Parse(m.Groups[4].Value));
{
try
{
gettext.Add(m.Groups[1].Value, Int32.Parse(m.Groups[4].Value));
}
catch (ArgumentException)
{
MessageBox.Show("There is a duplicate key in textdata_en. This may cause errors in the comment display of text.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
catch
{
MessageBox.Show("Unknown error in textdata_en. This may cause errors in the comment display of text.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}

Expand Down

0 comments on commit ffe4496

Please sign in to comment.