diff --git a/client/lobby/CSelectionBase.cpp b/client/lobby/CSelectionBase.cpp index 7b49da41c..d8ebc256d 100644 --- a/client/lobby/CSelectionBase.cpp +++ b/client/lobby/CSelectionBase.cpp @@ -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) diff --git a/client/lobby/OptionsTab.cpp b/client/lobby/OptionsTab.cpp index 4d5aa771c..97bb2383b 100644 --- a/client/lobby/OptionsTab.cpp +++ b/client/lobby/OptionsTab.cpp @@ -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;