summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-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));
}