From 5410acffaa53bdca7960377ea1722f62413c382c Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sun, 16 Nov 2025 13:48:57 -0800 Subject: [PATCH] fix: chat server crash (#1931) * fix: chat server crash * Update dChatServer/ChatServer.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- dChatServer/ChatServer.cpp | 3 +++ dWeb/Web.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index 34b4d6e3..13f2bde0 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -202,8 +202,11 @@ int main(int argc, char** argv) { //Delete our objects here: Database::Destroy("ChatServer"); delete Game::server; + Game::server = nullptr; delete Game::logger; + Game::logger = nullptr; delete Game::config; + Game::config = nullptr; return EXIT_SUCCESS; } diff --git a/dWeb/Web.cpp b/dWeb/Web.cpp index abf9bd36..f8cf2edf 100644 --- a/dWeb/Web.cpp +++ b/dWeb/Web.cpp @@ -184,7 +184,7 @@ static void DLOG(char ch, void *param) { static size_t len{}; if (ch != '\n') buf[len++] = ch; // we provide the newline in our logger if (ch == '\n' || len >= sizeof(buf)) { - LOG_DEBUG("%.*s", static_cast(len), buf); + if (Game::logger) LOG_DEBUG("%.*s", static_cast(len), buf); len = 0; } }