diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2009-10-04 16:59:15 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2009-10-04 16:59:15 +0200 |
commit | d9c38594fcd8c653b95ac6bf8cf525ae21a13195 (patch) | |
tree | 3e27958ff20edc5fd088daf0a74e4468ed418c8a /src | |
parent | 5004d3697157605615a95871ba74134a0936b2dd (diff) | |
download | mana-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.tar.gz mana-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.tar.bz2 mana-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.tar.xz mana-d9c38594fcd8c653b95ac6bf8cf525ae21a13195.zip |
Fixed crash in server dialog when there are no previous servers
Reported by Kess.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/serverdialog.cpp | 7 |
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)); } |