From 902c9dfdc58265b6b590686c30d100fc4b422388 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Mon, 10 May 2021 18:26:28 -0700 Subject: [PATCH] WebSocketServer: Don't try to send events if the server is not listening --- src/WebSocketServer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/WebSocketServer.cpp b/src/WebSocketServer.cpp index bf26dfdb..1d575afa 100644 --- a/src/WebSocketServer.cpp +++ b/src/WebSocketServer.cpp @@ -188,6 +188,9 @@ std::vector WebSocketServer::GetWebSocke // It isn't consistent to directly call the WebSocketServer from the events system, but it would also be dumb to make it unnecessarily complicated. void WebSocketServer::BroadcastEvent(uint64_t requiredIntent, std::string eventType, json eventData) { + if (!_server.is_listening()) + return; + QtConcurrent::run(&_threadPool, [=]() { // Populate message object json eventMessage;