diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-04-02 21:46:41 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-04-07 16:32:07 +0800 |
| commit | 2b97b774663b44c86eb3f8029d690bbe9a433ec8 (patch) | |
| tree | 236d5351193a5aedb953429b6719d1e3967bf8df /src/sessionManager.cpp | |
| parent | c356b3f6dec8a9175c0cc388ed5fd44e7fd17824 (diff) | |
fix: nullptr(SEGEV) during shutdown
Diffstat (limited to 'src/sessionManager.cpp')
| -rw-r--r-- | src/sessionManager.cpp | 7 |
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"); |
