mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Try to handle crash on map selection screen
This commit is contained in:
		| @@ -74,7 +74,14 @@ int ISelectionScreenInfo::getCurrentDifficulty() | ||||
|  | ||||
| PlayerInfo ISelectionScreenInfo::getPlayerInfo(PlayerColor color) | ||||
| { | ||||
| 	return getMapInfo()->mapHeader->players.at(color.getNum()); | ||||
| 	auto mapInfo = getMapInfo(); | ||||
| 	if (!mapInfo) | ||||
| 		throw std::runtime_error("Attempt to get player info for invalid map!"); | ||||
|  | ||||
| 	if (!mapInfo->mapHeader) | ||||
| 		throw std::runtime_error("Attempt to get player info for invalid map header!"); | ||||
|  | ||||
| 	return mapInfo->mapHeader->players.at(color.getNum()); | ||||
| } | ||||
|  | ||||
| CSelectionBase::CSelectionBase(ESelectionScreen type) | ||||
|   | ||||
| @@ -933,6 +933,9 @@ void OptionsTab::SelectedBox::showPopupWindow(const Point & cursorPosition) | ||||
|  | ||||
| void OptionsTab::SelectedBox::clickReleased(const Point & cursorPosition) | ||||
| { | ||||
| 	if (!SEL) | ||||
| 		return; | ||||
|  | ||||
| 	if(SEL->screenType != ESelectionScreen::newGame) | ||||
| 		return; | ||||
| 	 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user