From 00ff4ccd087fafd6368979d27b81829415d10db0 Mon Sep 17 00:00:00 2001 From: Artur Date: Tue, 24 Sep 2024 19:55:47 +0000 Subject: [PATCH] Fix possible NRE in AddOakton --- src/Oakton/HostedCommandExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Oakton/HostedCommandExtensions.cs b/src/Oakton/HostedCommandExtensions.cs index e2575f1..4702e2a 100644 --- a/src/Oakton/HostedCommandExtensions.cs +++ b/src/Oakton/HostedCommandExtensions.cs @@ -21,7 +21,10 @@ public static class HostedCommandExtensions /// public static void AddOakton(this IServiceCollection services, Action? options = null) { - services.Configure(options); + if (options is not null) + { + services.Configure(options); + } services.TryAddScoped();