From 92104315beca1dc75acfbb57ecadb5ef20c84df2 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 4 Jan 2021 05:43:51 +0100 Subject: [PATCH] GUI: No silent crash on startup if plugin option type has changed --- Il2CppInspector.GUI/App.xaml.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector.GUI/App.xaml.cs b/Il2CppInspector.GUI/App.xaml.cs index f4f8e89..b45b593 100644 --- a/Il2CppInspector.GUI/App.xaml.cs +++ b/Il2CppInspector.GUI/App.xaml.cs @@ -165,7 +165,11 @@ namespace Il2CppInspectorGUI _ => throw new ArgumentException("Unsupported JSON type") }); } - managedPlugin.SetOptions(options, OptionBehaviour.NoValidation); + + // An invalid cast will occur if a plugin author changes the type of one of its options + try { + managedPlugin.SetOptions(options, OptionBehaviour.NoValidation); + } catch (InvalidCastException) { } } } }