From 22c81087c05cf216c8ab0ff29c82677db96e9ed7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 10 Aug 2011 04:00:18 +0300 Subject: Fix crash in server dialog if press load button more than one time. --- src/gui/serverdialog.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gui/serverdialog.cpp') 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); } -- cgit v1.2.3-70-g09d2