summaryrefslogtreecommitdiff
path: root/src/sessionManager.cpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-04-02 21:46:41 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-04-07 16:32:07 +0800
commit2b97b774663b44c86eb3f8029d690bbe9a433ec8 (patch)
tree236d5351193a5aedb953429b6719d1e3967bf8df /src/sessionManager.cpp
parentc356b3f6dec8a9175c0cc388ed5fd44e7fd17824 (diff)
fix: nullptr(SEGEV) during shutdown
Diffstat (limited to 'src/sessionManager.cpp')
-rw-r--r--src/sessionManager.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp
index d880640..49d65b1 100644
--- a/src/sessionManager.cpp
+++ b/src/sessionManager.cpp
@@ -8,12 +8,17 @@
#include <utility>
void CSessionManager::shutdownSessions() {
+ if (m_vSessions.empty())
+ return;
+
for (auto &session : m_vSessions)
kick(&session, false, "Server shutting down");
}
CSessionManager::CSessionManager() {
- if (std::atexit([]() { g_pSessionManager->shutdownSessions(); }))
+ if (std::atexit([]() {
+ if (g_pSessionManager) g_pSessionManager->shutdownSessions();
+ }))
log(ERR, "Failed to register SessionManager atexit handler, will fallback to quick_exit after hang");
log(LOG, "SessionManager: initialized");