diff options
| author | AShifter <[email protected]> | 2017-05-02 20:08:43 -0600 |
|---|---|---|
| committer | AShifter <[email protected]> | 2017-05-02 20:08:43 -0600 |
| commit | 2fede89938014129cf50d66d5ff62af1bde4a477 (patch) | |
| tree | 5f33f4d600401d5807281c41b75dfa1ca5568f6b /ShiftOS.WinForms/Applications/Skin Loader.cs | |
| parent | 5b8d350af0dc2a9862fa3a8007be362fc91e6eba (diff) | |
| download | shiftos_thereturn-2fede89938014129cf50d66d5ff62af1bde4a477.tar.gz shiftos_thereturn-2fede89938014129cf50d66d5ff62af1bde4a477.tar.bz2 shiftos_thereturn-2fede89938014129cf50d66d5ff62af1bde4a477.zip | |
Catch invalid skin file
I accidentally tried to load 0.0.x skin file, and it crashed. Added a
try/catch around it and if caught, give an infobox saying "This skin is
not compatible with this version of ShiftOS.".
Diffstat (limited to 'ShiftOS.WinForms/Applications/Skin Loader.cs')
| -rw-r--r-- | ShiftOS.WinForms/Applications/Skin Loader.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs index 1f09e4a..f9857b7 100644 --- a/ShiftOS.WinForms/Applications/Skin Loader.cs +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -313,7 +313,15 @@ namespace ShiftOS.WinForms.Applications { AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action<string>((filename) => { - LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename)); + try + { + LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename)); + } + catch + { + Infobox.Show("Invalid Skin", "This skin is not compatible with this version of ShiftOS."); + } + SetupUI(); }))); } |
