fix: check for nulls in route switch descriptors

This commit is contained in:
Andrew Welker
2024-10-18 10:43:53 -05:00
parent fa38e8a9a8
commit f04f70495f
2 changed files with 3 additions and 3 deletions

View File

@@ -23,9 +23,9 @@
public override string ToString()
{
if (SwitchingDevice is IRouting)
return $"{SwitchingDevice?.Key} switches output {OutputPort.Key} to input {InputPort.Key}";
return $"{SwitchingDevice?.Key} switches output {OutputPort?.Key} to input {InputPort?.Key}";
else
return $"{SwitchingDevice.Key} switches to input {InputPort.Key}";
return $"{SwitchingDevice?.Key} switches to input {InputPort?.Key}";
}
}

View File

@@ -217,7 +217,7 @@ namespace PepperDash.Essentials.Core.Routing
var currentRoute = midpoint.CurrentRoutes.FirstOrDefault(route => {
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Checking {route} against {tieLine}", this, route, tieLine);
return route.OutputPort.Key == tieLine.SourcePort.Key && route.OutputPort.ParentDevice.Key == tieLine.SourcePort.ParentDevice.Key;
return route.OutputPort?.Key == tieLine.SourcePort.Key && route.OutputPort?.ParentDevice.Key == tieLine.SourcePort.ParentDevice.Key;
});
if (currentRoute == null)