From bbd62c366e7cbc19a5ebdb880de2370ce9b003bb Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:08:59 -0400 Subject: [PATCH] wsspectrum : Guard disconnected client logging Only log the disconnected client after confirming the socket pointer is valid. This avoids passing a null pointer to getWebSocketIdentifier() when socketDisconnected() is invoked without a valid client sender. Found by cppcheck. Signed-off-by: Robin Getz --- sdrbase/websockets/wsspectrum.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdrbase/websockets/wsspectrum.cpp b/sdrbase/websockets/wsspectrum.cpp index 401a7751d..ca69b99c7 100644 --- a/sdrbase/websockets/wsspectrum.cpp +++ b/sdrbase/websockets/wsspectrum.cpp @@ -126,10 +126,10 @@ void WSSpectrum::processClientMessage(const QString &message) void WSSpectrum::socketDisconnected() { QWebSocket *pClient = qobject_cast(sender()); - qDebug() << getWebSocketIdentifier(pClient) << " disconnected"; if (pClient) { + qDebug() << getWebSocketIdentifier(pClient) << " disconnected"; m_clients.removeAll(pClient); pClient->deleteLater(); }