diff --git a/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs b/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs index a3ff16a114..b2b4e7163b 100644 --- a/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs +++ b/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs @@ -67,6 +67,8 @@ namespace BizHawk.Emulation.Common public void Register(T provider) where T : IEmulatorService { + if (provider == null) + throw new ArgumentNullException("provider"); Services[typeof(T)] = provider; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs index c5c4a50439..39fed6f25b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs @@ -53,7 +53,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES if (board is BANDAI_FCG_1) { - (ServiceProvider as BasicServiceProvider).Register((board as BANDAI_FCG_1).reader); + var reader = (board as BANDAI_FCG_1).reader; + // not all BANDAI FCG 1 boards have a barcode reader + if (reader != null) + (ServiceProvider as BasicServiceProvider).Register(reader); } }