mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +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)
|
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)
|
CSelectionBase::CSelectionBase(ESelectionScreen type)
|
||||||
|
@@ -933,6 +933,9 @@ void OptionsTab::SelectedBox::showPopupWindow(const Point & cursorPosition)
|
|||||||
|
|
||||||
void OptionsTab::SelectedBox::clickReleased(const Point & cursorPosition)
|
void OptionsTab::SelectedBox::clickReleased(const Point & cursorPosition)
|
||||||
{
|
{
|
||||||
|
if (!SEL)
|
||||||
|
return;
|
||||||
|
|
||||||
if(SEL->screenType != ESelectionScreen::newGame)
|
if(SEL->screenType != ESelectionScreen::newGame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user