summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2009-10-04 16:59:15 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2009-10-04 16:59:15 +0200
commitd9c38594fcd8c653b95ac6bf8cf525ae21a13195 (patch)
tree3e27958ff20edc5fd088daf0a74e4468ed418c8a /src/gui/serverdialog.cpp
parent5004d3697157605615a95871ba74134a0936b2dd (diff)
downloadmana-client-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.tar.gz
mana-client-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.tar.bz2
mana-client-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.tar.xz
mana-client-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.zip
Fixed crash in server dialog when there are no previous servers
Reported by Kess.
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r--src/gui/serverdialog.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index d126c312..4f42906a 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -206,9 +206,12 @@ void ServerDialog::action(const gcn::ActionEvent &event)
void ServerDialog::valueChanged(const gcn::SelectionEvent &event)
{
+ const int index = mMostUsedServersList->getSelected();
+ if (index == -1)
+ return;
+
// Update the server and post fields according to the new selection
- const ServerInfo myServer = mMostUsedServersListModel->getServer
- (mMostUsedServersList->getSelected());
+ const ServerInfo myServer = mMostUsedServersListModel->getServer(index);
mServerNameField->setText(myServer.hostname);
mPortField->setText(toString(myServer.port));
}