Browse Source

Fix NRE on service providerless command execution (#322)

* fix not set to an instance of an object exception for service providerless command execution
pull/1958/head
Cenk Ergen GitHub 3 years ago
parent
commit
56a9283060
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs

+ 2
- 2
src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs View File

@@ -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:


Loading…
Cancel
Save