Check connectionState in stop so we don't null ref (#4557)

This commit is contained in:
Mikael Mengistu 2018-12-11 16:22:06 -08:00 committed by GitHub
parent 97cdbfb1a1
commit ff385f71c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -436,8 +436,11 @@ public class HubConnection {
exception = new RuntimeException(errorMessage); exception = new RuntimeException(errorMessage);
logger.error("HubConnection disconnected with an error {}.", errorMessage); logger.error("HubConnection disconnected with an error {}.", errorMessage);
} }
connectionState.cancelOutstandingInvocations(exception); if (connectionState != null) {
connectionState = null; connectionState.cancelOutstandingInvocations(exception);
connectionState = null;
}
logger.info("HubConnection stopped."); logger.info("HubConnection stopped.");
hubConnectionState = HubConnectionState.DISCONNECTED; hubConnectionState = HubConnectionState.DISCONNECTED;
handshakeResponseSubject.onComplete(); handshakeResponseSubject.onComplete();