Fixed: Nullable Eventhandler

This commit is contained in:
TheJoKlLa 2023-01-31 14:47:48 +01:00
parent a70eecd991
commit 1be9ffbf8a

View File

@ -274,7 +274,7 @@ namespace Capnp.Rpc
/// <summary>
/// State of Connection has changed
/// </summary>
public event EventHandler<ConnectionStateChange> ConnectionStateChanged;
public event EventHandler<ConnectionStateChange>? ConnectionStateChanged;
private ConnectionState _State = ConnectionState.Initializing;
@ -295,11 +295,7 @@ namespace Capnp.Rpc
};
_State = value;
EventHandler<ConnectionStateChange> eventHandler = ConnectionStateChanged;
if(eventHandler != null)
{
eventHandler(this, args);
}
ConnectionStateChanged?.Invoke(this, args);
}
}