diff --git a/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs b/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs index c31d09f60..f9fdb6e38 100644 --- a/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs +++ b/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs @@ -132,13 +132,13 @@ namespace Discord.Interactions case RunMode.Sync: { using var scope = services?.CreateScope(); - return await ExecuteInternalAsync(context, args, scope.ServiceProvider ?? EmptyServiceProvider.Instance).ConfigureAwait(false); + return await ExecuteInternalAsync(context, args, scope?.ServiceProvider ?? EmptyServiceProvider.Instance).ConfigureAwait(false); } case RunMode.Async: _ = Task.Run(async () => { using var scope = services?.CreateScope(); - await ExecuteInternalAsync(context, args, scope.ServiceProvider ?? EmptyServiceProvider.Instance).ConfigureAwait(false); + await ExecuteInternalAsync(context, args, scope?.ServiceProvider ?? EmptyServiceProvider.Instance).ConfigureAwait(false); }); break; default: