summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-05-21 19:45:32 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-05-21 19:56:53 +0200
commitc6168a565b14887f1ab7fdba9e0e5cd0a9f1ca1a (patch)
tree629fb6744f65bfadadf9237d85610660997f00b8 /src/client.cpp
parent2405b9500e0f87da4e3623c8f083247036c51297 (diff)
downloadmana-c6168a565b14887f1ab7fdba9e0e5cd0a9f1ca1a.tar.gz
mana-c6168a565b14887f1ab7fdba9e0e5cd0a9f1ca1a.tar.bz2
mana-c6168a565b14887f1ab7fdba9e0e5cd0a9f1ca1a.tar.xz
mana-c6168a565b14887f1ab7fdba9e0e5cd0a9f1ca1a.zip
Avoid a crash when the updateHost is set to nothing in the config file.
Reviewed-by: Jaxad0127
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 137210b1..75b24cc8 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1162,7 +1162,7 @@ void Client::initUpdatesDir()
}
// Remove any trailing slash at the end of the update host
- if (mUpdateHost.at(mUpdateHost.size() - 1) == '/')
+ if (!mUpdateHost.empty() && mUpdateHost.at(mUpdateHost.size() - 1) == '/')
mUpdateHost.resize(mUpdateHost.size() - 1);
// Parse out any "http://" or "ftp://", and set the updates directory
@@ -1170,7 +1170,7 @@ void Client::initUpdatesDir()
pos = mUpdateHost.find("://");
if (pos != mUpdateHost.npos)
{
- if (pos + 3 < mUpdateHost.length())
+ if (pos + 3 < mUpdateHost.length() && !mUpdateHost.empty())
{
updates << "updates/" << mUpdateHost.substr(pos + 3);
mUpdatesDir = updates.str();