From 1fb1947158ee80bc04877c6a4d35165d9c5d9ba5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 26 Jul 2024 06:51:45 -0500 Subject: [PATCH] fix: ReleaseRoute callse `ExecuteSwitch` with null for input selector Most devices that implement IRouting will now need to handle the possiblity of a null as the input selector, with the idea being that a null input selector should clear the route to whatever device is selected as the input selector. This may change to a typed value in the future. --- src/PepperDash.Essentials.Core/Routing/RouteDescriptor.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Routing/RouteDescriptor.cs b/src/PepperDash.Essentials.Core/Routing/RouteDescriptor.cs index ebacc809..3abafae4 100644 --- a/src/PepperDash.Essentials.Core/Routing/RouteDescriptor.cs +++ b/src/PepperDash.Essentials.Core/Routing/RouteDescriptor.cs @@ -60,10 +60,12 @@ namespace PepperDash.Essentials.Core /// public void ReleaseRoutes() { - foreach (var route in Routes) + foreach (var route in Routes.Where(r => r.SwitchingDevice is IRouting)) { - if (route.SwitchingDevice is IRouting) + if (route.SwitchingDevice is IRouting switchingDevice) { + switchingDevice.ExecuteSwitch(null, route.OutputPort.Selector, SignalType); + // Pull the route from the port. Whatever is watching the output's in use tracker is // responsible for responding appropriately. route.OutputPort.InUseTracker.RemoveUser(Destination, "destination-" + SignalType);