Avoid crash (index could be -1).
This commit is contained in:
parent
09a32c2132
commit
e2a6d1c33c
@ -174,8 +174,12 @@ void ServerSelection::eventCallback( GUIEngine::Widget* widget,
|
||||
int selected_index = m_server_list_widget->getSelectionID();
|
||||
// This can happen e.g. when the list is empty and the user
|
||||
// clicks somewhere.
|
||||
if(selected_index >= ServersManager::get()->getNumServers())
|
||||
if(selected_index >= ServersManager::get()->getNumServers() ||
|
||||
selected_index<0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Server *server =
|
||||
ServersManager::get()->getServerBySort(selected_index);
|
||||
uint32_t server_id = server->getServerId();
|
||||
|
Loading…
Reference in New Issue
Block a user