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>
This commit is contained in:
David Markowitz
2025-11-16 13:48:57 -08:00
committed by GitHub
parent 86f8601bbd
commit 5410acffaa
2 changed files with 4 additions and 1 deletions

View File

@@ -202,8 +202,11 @@ int main(int argc, char** argv) {
//Delete our objects here: //Delete our objects here:
Database::Destroy("ChatServer"); Database::Destroy("ChatServer");
delete Game::server; delete Game::server;
Game::server = nullptr;
delete Game::logger; delete Game::logger;
Game::logger = nullptr;
delete Game::config; delete Game::config;
Game::config = nullptr;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@@ -184,7 +184,7 @@ static void DLOG(char ch, void *param) {
static size_t len{}; static size_t len{};
if (ch != '\n') buf[len++] = ch; // we provide the newline in our logger if (ch != '\n') buf[len++] = ch; // we provide the newline in our logger
if (ch == '\n' || len >= sizeof(buf)) { if (ch == '\n' || len >= sizeof(buf)) {
LOG_DEBUG("%.*s", static_cast<int>(len), buf); if (Game::logger) LOG_DEBUG("%.*s", static_cast<int>(len), buf);
len = 0; len = 0;
} }
} }