From 9b4166dc4cb3b2147ced748f3c68d3072e38e5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Poul=20Kjeldager=20S=C3=B8rensen?= Date: Wed, 28 Aug 2024 07:37:35 +0200 Subject: [PATCH] added null checks --- src/Plugins/EntityPlugin1.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Plugins/EntityPlugin1.cs b/src/Plugins/EntityPlugin1.cs index 20a90fa..d54d0e7 100644 --- a/src/Plugins/EntityPlugin1.cs +++ b/src/Plugins/EntityPlugin1.cs @@ -145,6 +145,19 @@ public class DynamicEntityPlugin : EntityPlugin public override ValueTask ShouldPluginBeExecued(T context, TrackedPipelineItem entity) { + if (context is null) + { + throw new ArgumentNullException(nameof(context)); + } + if (entity.Entity is null) + { + throw new ArgumentNullException("Entry"); + } + if (entity.Entity.Entity is null) + { + throw new ArgumentNullException("Entity"); + } + var type = GetPluginType(context as TContext); return ValueTask.FromResult(type.IsAssignableFrom(entity.Entity.Entity.GetType()));