1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fixed possible uncaught exception on starting map

This commit is contained in:
Ivan Savenko
2023-08-06 17:46:49 +03:00
parent 9e4a42b25d
commit c524caee5c
3 changed files with 15 additions and 6 deletions

View File

@@ -572,7 +572,16 @@ void CServerHandler::sendRestartGame() const
void CServerHandler::sendStartGame(bool allowOnlyAI) const
{
verifyStateBeforeStart(allowOnlyAI ? true : settings["session"]["onlyai"].Bool());
try
{
verifyStateBeforeStart(allowOnlyAI ? true : settings["session"]["onlyai"].Bool());
}
catch (const std::exception & e)
{
showServerError( std::string("Unable to start map! Reason: ") + e.what());
return;
}
LobbyStartGame lsg;
if(client)
{
@@ -696,7 +705,7 @@ void CServerHandler::startCampaignScenario(std::shared_ptr<CampaignState> cs)
});
}
void CServerHandler::showServerError(std::string txt)
void CServerHandler::showServerError(std::string txt) const
{
CInfoWindow::showInfoDialog(txt, {});
}