Skip to content

Commit 787acc8

Browse files
committed
1 parent bd36c52 commit 787acc8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/java_websocket/WebSocketImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,12 @@ protected synchronized void closeConnection( int code, String message, boolean r
448448
// key.attach( null ); //see issue #114
449449
key.cancel();
450450
}
451-
try {
452-
channel.close();
453-
} catch ( IOException e ) {
454-
wsl.onWebsocketError( this, e );
451+
if( channel != null ) {
452+
try {
453+
channel.close();
454+
} catch ( IOException e ) {
455+
wsl.onWebsocketError( this, e );
456+
}
455457
}
456458
try {
457459
this.wsl.onWebsocketClose( this, code, message, remote );

0 commit comments

Comments
 (0)