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);
logger.error("HubConnection disconnected with an error {}.", errorMessage);
}
connectionState.cancelOutstandingInvocations(exception);
connectionState = null;
if (connectionState != null) {
connectionState.cancelOutstandingInvocations(exception);
connectionState = null;
}
logger.info("HubConnection stopped.");
hubConnectionState = HubConnectionState.DISCONNECTED;
handshakeResponseSubject.onComplete();