summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 323d5b49..35292d22 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -433,6 +433,14 @@ Client::~Client()
SDL_RemoveTimer(mLogicCounterId);
SDL_RemoveTimer(mSecondsCounterId);
+ // Unload XML databases
+ ColorDB::unload();
+ EmoteDB::unload();
+ ItemDB::unload();
+ MonsterDB::unload();
+ NPCDB::unload();
+ StatusEffect::unload();
+
// Before config.write() since it writes the shortcuts to the config
delete itemShortcut;
delete emoteShortcut;
@@ -586,19 +594,6 @@ int Client::exec()
{
delete game;
game = 0;
-
- if (mState != STATE_CHANGE_MAP)
- {
- // Unload XML databases
- ColorDB::unload();
- EmoteDB::unload();
- ItemDB::unload();
- MonsterDB::unload();
- NPCDB::unload();
- StatusEffect::unload();
-
- ActorSprite::unload();
- }
}
mOldState = mState;
@@ -973,6 +968,7 @@ int Client::exec()
case STATE_ERROR:
logger->log("State: ERROR");
+ logger->log("Error: %s\n", errorMessage.c_str());
mCurrentDialog = new OkDialog(_("Error"), errorMessage);
mCurrentDialog->addActionListener(&errorListener);
mCurrentDialog = NULL; // OkDialog deletes itself
@@ -1159,6 +1155,10 @@ void Client::initUpdatesDir()
mUpdateHost = config.getValue("updatehost", "");
}
+ // Don't go out of range int he next check
+ if (mUpdateHost.length() < 2)
+ return;
+
// Remove any trailing slash at the end of the update host
if (!mUpdateHost.empty() && mUpdateHost.at(mUpdateHost.size() - 1) == '/')
mUpdateHost.resize(mUpdateHost.size() - 1);