summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-10 04:00:18 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-10 04:00:18 +0300
commit22c81087c05cf216c8ab0ff29c82677db96e9ed7 (patch)
treed8e0c40d63cb2d9238f9e83bf034b3c3af0539ec /src/gui/serverdialog.cpp
parent11385d29ad80d16b00c42f67a9db583af462b9c1 (diff)
downloadmv-22c81087c05cf216c8ab0ff29c82677db96e9ed7.tar.gz
mv-22c81087c05cf216c8ab0ff29c82677db96e9ed7.tar.bz2
mv-22c81087c05cf216c8ab0ff29c82677db96e9ed7.tar.xz
mv-22c81087c05cf216c8ab0ff29c82677db96e9ed7.zip
Fix crash in server dialog if press load button more than one time.
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r--src/gui/serverdialog.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 140e4b629..41b0076e1 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -124,6 +124,9 @@ std::string ServersListModel::getElementAt(int elementIndex)
void ServersListModel::setVersionString(int index, const std::string &version)
{
+ if (index >= mVersionStrings.size())
+ return;
+
if (version.empty())
{
mVersionStrings[index] = VersionString(0, "");
@@ -604,6 +607,13 @@ void ServerDialog::downloadServerList()
if (listFile.empty())
listFile = "http://manasource.org/serverlist.xml";
+ if (mDownload)
+ {
+ mDownload->cancel();
+ delete mDownload;
+ mDownload = 0;
+ }
+
mDownload = new Net::Download(this, listFile, &downloadUpdate);
mDownload->setFile(mDir + "/serverlist.xml");
mDownload->start();
@@ -702,7 +712,6 @@ void ServerDialog::loadServers(bool addNew)
break;
}
}
-
if (!found && addNew)
mServers.push_back(server);
}