fix; add check for HdmiIn being null

Not all Airmedia devices that might use this class have
an HDMI input. This check should prevent null ref
exceptions from happening.
This commit is contained in:
Andrew Welker
2023-03-22 10:53:57 -06:00
parent e04f6d0396
commit f253abd0ae

View File

@@ -110,9 +110,16 @@ namespace PepperDash.Essentials.DM.AirMedia
VideoOutFeedback = new IntFeedback(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback));
AutomaticInputRoutingEnabledFeedback = new BoolFeedback(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue);
AirMedia.HdmiIn.StreamChange += HdmiIn_StreamChange;
// Not all AirMedia versions support HDMI In like the 3200
if (AirMedia.HdmiIn != null)
{
AirMedia.HdmiIn.StreamChange += HdmiIn_StreamChange;
HdmiVideoSyncDetectedFeedback = new BoolFeedback(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue);
return;
}
HdmiVideoSyncDetectedFeedback = new BoolFeedback(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue);
// Return false if the AirMedia device doesn't support HDMI Input
HdmiVideoSyncDetectedFeedback = new BoolFeedback(() => false);
}
public override bool CustomActivate()