diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/serverdialog.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index cde56875f..fa23c95f3 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -300,13 +300,14 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): loadWindowState(); - mServersList->setSelected(0); // Do this after for the Delete button setVisible(true); mConnectButton->requestFocus(); loadServers(true); + mServersList->setSelected(0); // Do this after for the Delete button + if (needUpdateServers()) downloadServerList(); } @@ -330,6 +331,10 @@ void ServerDialog::action(const gcn::ActionEvent &event) if (Client::getState() == STATE_CONNECT_SERVER) return; + int index = mServersList->getSelected(); + if (index < 0) + return; + if (mDownload) mDownload->cancel(); @@ -337,10 +342,6 @@ void ServerDialog::action(const gcn::ActionEvent &event) mConnectButton->setEnabled(false); mLoadButton->setEnabled(false); - int index = mServersList->getSelected(); - if (index < 0) - return; - ServerInfo server = mServers.at(index); mServerInfo->hostname = server.hostname; mServerInfo->port = server.port; @@ -598,6 +599,8 @@ void ServerDialog::loadServers(bool addNew) if (!found && addNew) mServers.push_back(server); } + if (mServersList->getSelected() < 0) + mServersList->setSelected(0); } void ServerDialog::loadCustomServers() |