diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index fbece646..a66bcfc2 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -812,6 +812,7 @@ void HandlePacket(Packet* packet) { } int ShutdownSequence(int32_t signal) { + if (!Game::logger) return -1; LOG("Recieved Signal %d", signal); if (shutdownSequenceStarted) { LOG("Duplicate Shutdown Sequence"); @@ -900,9 +901,13 @@ int32_t FinalizeShutdown(int32_t signal) { //Delete our objects here: Database::Destroy("MasterServer"); if (Game::config) delete Game::config; + Game::config = nullptr; if (Game::im) delete Game::im; + Game::im = nullptr; if (Game::server) delete Game::server; + Game::server = nullptr; if (Game::logger) delete Game::logger; + Game::logger = nullptr; if (signal != EXIT_SUCCESS) exit(signal); return signal; diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 6cac52d5..31fd488c 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -1291,14 +1291,17 @@ void WorldShutdownProcess(uint32_t zoneId) { } void WorldShutdownSequence() { + bool shouldShutdown = Game::ShouldShutdown() || worldShutdownSequenceComplete; Game::lastSignal = -1; #ifndef DARKFLAME_PLATFORM_WIN32 - if (Game::ShouldShutdown() || worldShutdownSequenceComplete) + if (shouldShutdown) #endif { return; } + if (!Game::logger) return; + LOG("Zone (%i) instance (%i) shutting down outside of main loop!", Game::server->GetZoneID(), instanceID); WorldShutdownProcess(Game::server->GetZoneID()); FinalizeShutdown();