Fix potential NPE when closing a websocket that failed to open properly

This commit is contained in:
catbref 2020-12-01 17:22:40 +00:00
parent 1b50dd5adf
commit 7562d9bbf8

View File

@ -107,7 +107,9 @@ abstract class ApiWebSocket extends WebSocketServlet {
public void onWebSocketClose(Session session, int statusCode, String reason) {
synchronized (SESSIONS_BY_CLASS) {
SESSIONS_BY_CLASS.get(this.getClass()).remove(session);
List<Session> sessions = SESSIONS_BY_CLASS.get(this.getClass());
if (sessions != null)
sessions.remove(session);
}
}