From dd7408dbf14eea51936a9bda2ce922dd2e37baf6 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 18 Nov 2019 14:27:11 -0700 Subject: [PATCH] Modifies SetupInputCards() to try to fix a NullReferenceException being thrown. Adds a debug statement to check if a given card in the collection can't be cast as DMInput. --- .../Chassis/DmpsRoutingController.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 8d83e7c1..c3a5f431 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -213,10 +213,10 @@ namespace PepperDash.Essentials.DM { var inputCard = card as DMInput; - Debug.Console(1, this, "Adding Input Card Number {0} Type: {1}", inputCard.Number, inputCard.CardInputOutputType.ToString()); - if (inputCard != null) { + Debug.Console(1, this, "Adding Input Card Number {0} Type: {1}", inputCard.Number, inputCard.CardInputOutputType.ToString()); + InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => { return inputCard.EndpointOnlineFeedback; }); if (inputCard.VideoDetectedFeedback != null) @@ -226,12 +226,13 @@ namespace PepperDash.Essentials.DM return inputCard.VideoDetectedFeedback.BoolValue; }); } + InputNameFeedbacks[inputCard.Number] = new StringFeedback(() => { if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue)) { Debug.Console(2, this, "Input Card {0} Name: {1}", inputCard.Number, inputCard.NameFeedback.StringValue); - return inputCard.NameFeedback.StringValue; + return inputCard.NameFeedback.StringValue; } else @@ -240,9 +241,13 @@ namespace PepperDash.Essentials.DM return ""; } }); - } - AddInputCard(inputCard.Number, inputCard); + AddInputCard(inputCard.Number, inputCard); + } + else + { + Debug.Console(2, this, "***********Input Card of type {0} is cannot be cast as DMInput*************", card.CardInputOutputType); + } } }