Fix segfault in server list without a server selection (#374)
Also bumps C++ version to C++17 (C++1z).
This commit is contained in:
		
							parent
							
								
									883fa8547d
								
							
						
					
					
						commit
						05dd086fff
					
				@ -35,7 +35,7 @@ LIBS += -lbassopus
 | 
			
		||||
 | 
			
		||||
macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices
 | 
			
		||||
 | 
			
		||||
CONFIG += c++14
 | 
			
		||||
CONFIG += c++17
 | 
			
		||||
 | 
			
		||||
RESOURCES += resources.qrc
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -283,7 +283,10 @@ QString Lobby::get_chatlog()
 | 
			
		||||
 | 
			
		||||
int Lobby::get_selected_server()
 | 
			
		||||
{
 | 
			
		||||
  return ui_server_list->currentItem()->text(0).toInt();
 | 
			
		||||
  if (auto item = ui_server_list->currentItem()) {
 | 
			
		||||
    return item->text(0).toInt();
 | 
			
		||||
  }
 | 
			
		||||
  return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_loading_value(int p_value)
 | 
			
		||||
@ -333,12 +336,12 @@ void Lobby::on_add_to_fav_pressed()
 | 
			
		||||
void Lobby::on_add_to_fav_released()
 | 
			
		||||
{
 | 
			
		||||
  ui_add_to_fav->set_image("addtofav");
 | 
			
		||||
 | 
			
		||||
  // you cant add favorites from favorites m8
 | 
			
		||||
  if (!public_servers_selected)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  ao_app->add_favorite_server(get_selected_server());
 | 
			
		||||
  if (public_servers_selected) {
 | 
			
		||||
    int selection = get_selected_server();
 | 
			
		||||
    if (selection > -1) {
 | 
			
		||||
      ao_app->add_favorite_server(selection);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_connect_pressed() { ui_connect->set_image("connect_pressed"); }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user