diff --git a/src/Bird.Socket.Client.pas b/src/Bird.Socket.Client.pas index ade2ed7..4f4a0f3 100644 --- a/src/Bird.Socket.Client.pas +++ b/src/Bird.Socket.Client.pas @@ -199,10 +199,14 @@ procedure TBirdSocketClient.AddEventListener(const AEventType: TEventType; const case AEventType of TEventType.OPEN: begin + if Assigned(FOnOpen) then + raise Exception.Create('The open event listener is already assigned!'); FOnOpen := AEvent; end; TEventType.MESSAGE: begin + if Assigned(FOnMessage) then + raise Exception.Create('The message event listener is already assigned!'); FOnMessage := AEvent; end; else