mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-13 19:58:21 +00:00
fix: nullptr access for logger in master (#1380)
* fix nullptr access for logger * fix nullptr access for logger fix no save on crash * Update MasterServer.cpp
This commit is contained in:
parent
b1134b340f
commit
bb79528c0e
@ -812,6 +812,7 @@ void HandlePacket(Packet* packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ShutdownSequence(int32_t signal) {
|
int ShutdownSequence(int32_t signal) {
|
||||||
|
if (!Game::logger) return -1;
|
||||||
LOG("Recieved Signal %d", signal);
|
LOG("Recieved Signal %d", signal);
|
||||||
if (shutdownSequenceStarted) {
|
if (shutdownSequenceStarted) {
|
||||||
LOG("Duplicate Shutdown Sequence");
|
LOG("Duplicate Shutdown Sequence");
|
||||||
@ -900,9 +901,13 @@ int32_t FinalizeShutdown(int32_t signal) {
|
|||||||
//Delete our objects here:
|
//Delete our objects here:
|
||||||
Database::Destroy("MasterServer");
|
Database::Destroy("MasterServer");
|
||||||
if (Game::config) delete Game::config;
|
if (Game::config) delete Game::config;
|
||||||
|
Game::config = nullptr;
|
||||||
if (Game::im) delete Game::im;
|
if (Game::im) delete Game::im;
|
||||||
|
Game::im = nullptr;
|
||||||
if (Game::server) delete Game::server;
|
if (Game::server) delete Game::server;
|
||||||
|
Game::server = nullptr;
|
||||||
if (Game::logger) delete Game::logger;
|
if (Game::logger) delete Game::logger;
|
||||||
|
Game::logger = nullptr;
|
||||||
|
|
||||||
if (signal != EXIT_SUCCESS) exit(signal);
|
if (signal != EXIT_SUCCESS) exit(signal);
|
||||||
return signal;
|
return signal;
|
||||||
|
@ -1291,14 +1291,17 @@ void WorldShutdownProcess(uint32_t zoneId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WorldShutdownSequence() {
|
void WorldShutdownSequence() {
|
||||||
|
bool shouldShutdown = Game::ShouldShutdown() || worldShutdownSequenceComplete;
|
||||||
Game::lastSignal = -1;
|
Game::lastSignal = -1;
|
||||||
#ifndef DARKFLAME_PLATFORM_WIN32
|
#ifndef DARKFLAME_PLATFORM_WIN32
|
||||||
if (Game::ShouldShutdown() || worldShutdownSequenceComplete)
|
if (shouldShutdown)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Game::logger) return;
|
||||||
|
|
||||||
LOG("Zone (%i) instance (%i) shutting down outside of main loop!", Game::server->GetZoneID(), instanceID);
|
LOG("Zone (%i) instance (%i) shutting down outside of main loop!", Game::server->GetZoneID(), instanceID);
|
||||||
WorldShutdownProcess(Game::server->GetZoneID());
|
WorldShutdownProcess(Game::server->GetZoneID());
|
||||||
FinalizeShutdown();
|
FinalizeShutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user