Fixed crash from trying to close a socket that isn't open in the first place.

This commit is contained in:
Eelke Klein 2017-09-02 11:55:47 +02:00
parent aa50d3097e
commit 90d0a14b63

View file

@ -1,4 +1,4 @@
#include "ASyncDBConnection.h"
#include "ASyncDBConnection.h"
#include "ScopeGuard.h"
#include <chrono>
@ -87,8 +87,10 @@ void ASyncDBConnection::closeConnection()
if (m_state == State::QuerySend) {
m_canceller.cancel(nullptr);
}
if (m_state != State::NotConnected) {
m_asioSock.close();
m_connection.close();
}
doStateCallback(State::NotConnected);
}