Fix IDE0270: Null check can be simplified

This commit is contained in:
Haselnussbomber 2025-10-24 03:04:07 +02:00
parent 58aeb11268
commit a19094f4f3
No known key found for this signature in database
GPG key ID: BB905BB49E7295D1
8 changed files with 10 additions and 35 deletions

View file

@ -141,10 +141,7 @@ internal class PluginErrorHandler : IServiceType
private static Action<TDelegate, object[]> CreateInvoker<TDelegate>() where TDelegate : Delegate
{
var delegateType = typeof(TDelegate);
var method = delegateType.GetMethod("Invoke");
if (method == null)
throw new InvalidOperationException($"Delegate {delegateType} does not have an Invoke method.");
var method = delegateType.GetMethod("Invoke") ?? throw new InvalidOperationException($"Delegate {delegateType} does not have an Invoke method.");
var parameters = method.GetParameters();
// Create parameters for the lambda