Fix crash when pressing delete button in server browser and no server is selected.
authorJürgen Doser <jurgen.doser@gmail.com>
Tue, 22 Jan 2013 15:55:50 +0000 (16:55 +0100)
committerJürgen Doser <jurgen.doser@gmail.com>
Tue, 22 Jan 2013 18:05:46 +0000 (19:05 +0100)
A check for that was there, but was comparing an unsigned variable to
-1, which doesn't work.

src/guiMainMenu.cpp

index 68ee990cd1d46a5753b21de0dd9be42178010445..9291bb4ec5d95d036e9751a93c7fa0cc71c3f6ef 100644 (file)
@@ -1053,7 +1053,7 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
                        }
                        case GUI_ID_SERVERLIST_DELETE: {
                                gui::IGUIListBox *serverlist = (gui::IGUIListBox*)getElementFromId(GUI_ID_SERVERLIST);
-                               u16 selected = ((gui::IGUIListBox*)serverlist)->getSelected();
+                               s32 selected = ((gui::IGUIListBox*)serverlist)->getSelected();
                                if (selected == -1) return true;
                                ServerList::deleteEntry(m_data->servers[selected]);
                                m_data->servers = ServerList::getLocal();