From 1ebf213faba82e93510ab689ea9a7ce92033a56a Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 24 Jan 2024 12:04:27 +0100 Subject: Fixed potential crash on exit --- src/client.cpp | 3 +-- src/resources/settingsmanager.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 92c8c63a..b7dca379 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -761,8 +761,7 @@ int Client::exec() // Load XML databases CharDB::load(); - if (itemDb) - delete itemDb; + delete itemDb; switch (Net::getNetworkType()) { diff --git a/src/resources/settingsmanager.cpp b/src/resources/settingsmanager.cpp index 940ebb59..a26fae9d 100644 --- a/src/resources/settingsmanager.cpp +++ b/src/resources/settingsmanager.cpp @@ -85,7 +85,8 @@ namespace SettingsManager NPCDB::unload(); SpecialDB::unload(); MonsterDB::unload(); - itemDb->unload(); + if (itemDb) + itemDb->unload(); hairDB.unload(); Attributes::unload(); } @@ -209,4 +210,3 @@ namespace SettingsManager } } - -- cgit v1.2.3-70-g09d2