From c56841d95b2d9ed3871f2d05b6d787660feb927d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 22 Jul 2024 11:19:34 -0500 Subject: [PATCH] fix: attempt to catch a null ref happening in the Route Descriptor --- .../Routing/RouteDescriptorCollection.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Routing/RouteDescriptorCollection.cs b/src/PepperDash.Essentials.Core/Routing/RouteDescriptorCollection.cs index c9e3da37..8792a123 100644 --- a/src/PepperDash.Essentials.Core/Routing/RouteDescriptorCollection.cs +++ b/src/PepperDash.Essentials.Core/Routing/RouteDescriptorCollection.cs @@ -1,8 +1,7 @@ -using System.Collections.Generic; -using System.Linq; - -using PepperDash.Core; +using PepperDash.Core; using Serilog.Events; +using System.Collections.Generic; +using System.Linq; namespace PepperDash.Essentials.Core @@ -33,6 +32,11 @@ namespace PepperDash.Essentials.Core /// public void AddRouteDescriptor(RouteDescriptor descriptor) { + if (descriptor == null) + { + return; + } + if (RouteDescriptors.Any(t => t.Destination == descriptor.Destination)) { Debug.LogMessage(LogEventLevel.Debug, descriptor.Destination,