Skip to content

Commit

Permalink
Add out-of-bounds check to get_sdf_name()
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios authored and CelticMinstrel committed Mar 6, 2025
1 parent a6d5e29 commit f091d46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/scenario/scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ std::string cScenario::get_feature_flag(std::string flag) {
}

std::string cScenario::get_sdf_name(int row, int col) {
if(row < 0 || row >= SDF_ROWS || col < 0 || col >= SDF_COLUMNS){
throw "Tried to access SDF name for out-of-bounds flag (" + std::to_string(row) + ", " + std::to_string(col) + ")";
}
if(sdf_names.find(row) == sdf_names.end())
return "";
if(sdf_names[row].find(col) == sdf_names[row].end())
Expand Down

0 comments on commit f091d46

Please sign in to comment.