moquette-io / moquette

Java MQTT lightweight broker
http://moquette-io.github.io/moquette/
Apache License 2.0
2.27k stars 814 forks source link

Avoid NPE if broker yet not started #743

Closed source-c closed 1 year ago

source-c commented 1 year ago

make listConnectedClients method safe for all broker states

Formaly, there is nothing to restrict one to call clients listing (server.listConnectedClients()) immediatelly after constructing instance using new Server();. In this case caller will get NulPointerException which may ruin the runtime. This PR fixes that.

source-c commented 1 year ago

I've make changes in code in accordance to your suggestions in the code review.

source-c commented 1 year ago

Entirely agree. Commited.