diff --git a/client.cpp b/client.cpp index a720d1e..89a6cb6 100644 --- a/client.cpp +++ b/client.cpp @@ -69,7 +69,7 @@ Client::~Client() close(fd); } - if (session->getDestroyOnDisconnect()) + if (session && session->getDestroyOnDisconnect()) { store->removeSession(session); } diff --git a/subscriptionstore.cpp b/subscriptionstore.cpp index 61be9bd..bafd082 100644 --- a/subscriptionstore.cpp +++ b/subscriptionstore.cpp @@ -634,6 +634,9 @@ void SubscriptionStore::removeExpiredSessionsClients() void SubscriptionStore::queueSessionRemoval(const std::shared_ptr &session) { + if (!session) + return; + QueuedSessionRemoval qsr(session); auto comp = [](const QueuedSessionRemoval &a, const QueuedSessionRemoval &b)