Skip to content

Commit 4b3c5f4

Browse files
committed
Catch exception for map list
1 parent 2cdb90e commit 4b3c5f4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Pregame.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,15 @@ void Pregame :: preload() {
8080

8181
string mapno = m_pQor->args().value("map");
8282
int map_number = boost::lexical_cast<int>(mapno);
83-
84-
auto map_name = lines.at(map_number - 1);
85-
m_pText->set(string("Now entering: ") + map_name);
83+
84+
string map_name;
85+
try {
86+
map_name = lines.at(map_number - 1);
87+
}catch (const std::out_of_range&) {
88+
m_Win = true;
89+
return;
90+
}
91+
m_pText->set(string("Now entering: ") + map_name);
8692

8793
//// TEMP: just for jam
8894
/*

0 commit comments

Comments
 (0)