fix: checks the routing output port for null

This commit is contained in:
Nick Genovese
2024-10-24 20:52:24 -04:00
parent d11827bc7b
commit 0e16dff90c

View File

@@ -72,13 +72,23 @@ namespace PepperDash.Essentials.Core
{ {
if (route.SwitchingDevice is IRouting switchingDevice) if (route.SwitchingDevice is IRouting switchingDevice)
{ {
if (route.OutputPort == null)
{
continue;
}
switchingDevice.ExecuteSwitch(null, route.OutputPort.Selector, SignalType); switchingDevice.ExecuteSwitch(null, route.OutputPort.Selector, SignalType);
// Pull the route from the port. Whatever is watching the output's in use tracker is if (route.OutputPort.InUseTracker != null)
// responsible for responding appropriately. {
route.OutputPort.InUseTracker.RemoveUser(Destination, "destination-" + SignalType); route.OutputPort.InUseTracker.RemoveUser(Destination, "destination-" + SignalType);
Debug.LogMessage(LogEventLevel.Verbose, "Port {0} releasing. Count={1}", null, route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue); Debug.LogMessage(LogEventLevel.Verbose, "Port {0} releasing. Count={1}", null, route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue);
} }
else
{
Debug.LogMessage(LogEventLevel.Error, "InUseTracker is null for OutputPort {0}", null, route.OutputPort.Key);
}
}
} }
} }