Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
diff FrmMain.cs @ 74:f1b7a08a8f6f
Re #177: "Crash" when equipmenttag
* Show custom dialog instead of crashing
Exception messages could still be improved and translatable
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 28 Sep 2009 19:56:50 +0000 |
parents | 12f11e3c6261 |
children | c243b043aa62 |
line wrap: on
line diff
--- a/FrmMain.cs Mon Sep 28 19:50:16 2009 +0000 +++ b/FrmMain.cs Mon Sep 28 19:56:50 2009 +0000 @@ -571,7 +571,18 @@ if (dr == DialogResult.OK) { - CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize); + try + { + CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize); + } + catch (RequiredDataMissingException ex) + { + MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "Invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error); + } + catch (InvalidFileException ex) + { + MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "Invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } }