diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs index eb388350fe..7be8f479b2 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs @@ -74,16 +74,18 @@ namespace BizHawk.Client.EmuHawk { ControllerPanel.Controls.Clear(); - var schemaType = EmuHawk.ReflectionCache.Types - .Where(t => typeof(IVirtualPadSchema) - .IsAssignableFrom(t) && t.GetCustomAttributes(false) - .OfType() - .Any()) - .FirstOrDefault(t => t.GetCustomAttributes(false) - .OfType() - .First().SystemId == Emulator.SystemId); - - if (schemaType == null) return; + Type schemaType; + try + { + schemaType = EmuHawk.ReflectionCache.Types.Where(typeof(IVirtualPadSchema).IsAssignableFrom) + .Select(t => (SchemaType: t, Attr: t.GetCustomAttributes(false).OfType().FirstOrDefault())) + .First(tuple => tuple.Attr?.SystemId == Emulator.SystemId) + .SchemaType; + } + catch (Exception) + { + return; + } var padSchemata = ((IVirtualPadSchema) Activator.CreateInstance(schemaType)) .GetPadSchemas(Emulator, s => MessageBox.Show(s))