Prevent Null Pointer Exception if socket connection is broken (#12223)
Signed-off-by: EvilPingu <ckittel@gmx.de>
This commit is contained in:
parent
19fd145368
commit
0028b8d13c
|
@ -158,7 +158,12 @@ public class WebSocketConnection {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@OnWebSocketError
|
@OnWebSocketError
|
||||||
public void onError(Session session, Throwable cause) {
|
public void onError(@Nullable Session session, Throwable cause) {
|
||||||
|
if (session == null) {
|
||||||
|
logger.trace("Encountered an error while processing on error without session. Connection state is {}: {}",
|
||||||
|
connectionState, cause.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!session.equals(this.session)) {
|
if (!session.equals(this.session)) {
|
||||||
handleWrongSession(session, "Connection error: " + cause.getMessage());
|
handleWrongSession(session, "Connection error: " + cause.getMessage());
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue