From e9471c7197436e71a0de68b1b548d099dac4966b Mon Sep 17 00:00:00 2001 From: Aaron Brady Date: Fri, 17 Aug 2018 10:06:48 -0700 Subject: [PATCH] fix crash if SonarClient is stopped with no connection Summary: calling SonarClient::instance()->stop() without a connection will try to deref a null client_ Reviewed By: jknoxville Differential Revision: D9325527 fbshipit-source-id: b0a81d6eb9d1375b74cbf10466f947e8a2de3b98 --- xplat/Sonar/SonarWebSocketImpl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xplat/Sonar/SonarWebSocketImpl.cpp b/xplat/Sonar/SonarWebSocketImpl.cpp index 8b31085d6..46727ada0 100644 --- a/xplat/Sonar/SonarWebSocketImpl.cpp +++ b/xplat/Sonar/SonarWebSocketImpl.cpp @@ -218,7 +218,9 @@ void SonarWebSocketImpl::reconnect() { } void SonarWebSocketImpl::stop() { - client_->disconnect(); + if (client_) { + client_->disconnect(); + } client_ = nullptr; }