diff --git a/BizHawk.Client.EmuHawk/ToolAttribute.cs b/BizHawk.Client.EmuHawk/ToolAttribute.cs index 721fa0cf48..53a2f837da 100644 --- a/BizHawk.Client.EmuHawk/ToolAttribute.cs +++ b/BizHawk.Client.EmuHawk/ToolAttribute.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; namespace BizHawk.Client.EmuHawk { @@ -9,14 +10,14 @@ namespace BizHawk.Client.EmuHawk public ToolAttribute(bool released, string[] supportedSystems, string[] unsupportedCores = null) { Released = released; - SupportedSystems = supportedSystems; - UnsupportedCores = unsupportedCores; + SupportedSystems = supportedSystems ?? Enumerable.Empty(); + UnsupportedCores = unsupportedCores ?? Enumerable.Empty(); } - public bool Released { get; private set; } + public bool Released { get; } - public IEnumerable SupportedSystems { get; private set; } + public IEnumerable SupportedSystems { get; } - public IEnumerable UnsupportedCores { get; private set; } + public IEnumerable UnsupportedCores { get; } } } diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs index fef10a6b4b..e8bc2338ae 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -752,12 +752,8 @@ namespace BizHawk.Client.EmuHawk return false; } - ToolAttribute attr; - try - { - attr = tool.GetCustomAttributes(false).OfType().Single(); - } - catch (InvalidOperationException e) + ToolAttribute attr = tool.GetCustomAttributes(false).OfType().SingleOrDefault(); + if (attr == null) { return true; // no ToolAttribute on given type -> assumed all supported }