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> /// <summary>
/// State of Connection has changed /// State of Connection has changed
/// </summary> /// </summary>
public event EventHandler<ConnectionStateChange> ConnectionStateChanged; public event EventHandler<ConnectionStateChange>? ConnectionStateChanged;
private ConnectionState _State = ConnectionState.Initializing; private ConnectionState _State = ConnectionState.Initializing;
@ -295,13 +295,9 @@ namespace Capnp.Rpc
}; };
_State = value; _State = value;
EventHandler<ConnectionStateChange> eventHandler = ConnectionStateChanged; ConnectionStateChanged?.Invoke(this, args);
if(eventHandler != null)
{
eventHandler(this, args);
}
} }
} }
/// <summary> /// <summary>
/// Gets the number of RPC protocol messages sent by this client so far. /// Gets the number of RPC protocol messages sent by this client so far.