From 10e38e7bc9217a31534650ca9c20799809da3fad Mon Sep 17 00:00:00 2001 From: goyuken Date: Sun, 14 Dec 2014 17:19:54 +0000 Subject: [PATCH] fix BANDAI FCG 1 Boards without barcode reader --- .../Base Implementations/BasicServiceProvider.cs | 2 ++ BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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); } }