Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Commit

Permalink
Fix NRE on service providerless command execution (#322)
Browse files Browse the repository at this point in the history
* fix not set to an instance of an object exception for service providerless command execution
  • Loading branch information
Cenngo authored Nov 28, 2021
1 parent 9d69217 commit 56a9283
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ protected async Task<IResult> RunAsync(IInteractionContext context, object[] arg
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:
Expand Down

0 comments on commit 56a9283

Please sign in to comment.