Skip to content

Commit

Permalink
Fail fast if transport is null, check for null on close
Browse files Browse the repository at this point in the history
  • Loading branch information
jazdw committed Nov 2, 2023
1 parent 9c7adae commit 1e02fd7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public class MessageControl implements DataConsumer {
*/
public void start(Transport transport, MessageParser messageParser, RequestHandler handler,
WaitingRoomKeyFactory waitingRoomKeyFactory) throws IOException {
if (transport == null) {
throw new IllegalArgumentException("transport cannot be null");
}
this.transport = transport;
this.messageParser = messageParser;
this.requestHandler = handler;
Expand All @@ -64,7 +67,9 @@ public void start(Transport transport, MessageParser messageParser, RequestHandl
* <p>close.</p>
*/
public void close() {
transport.removeConsumer();
if (transport != null) {
transport.removeConsumer();
}
}

/**
Expand Down

0 comments on commit 1e02fd7

Please sign in to comment.