Skip to content

Commit f01eec9

Browse files
authored
check, assert, and skip as needed (scp-fs2open#7297)
1 parent 100b897 commit f01eec9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

code/mission/missionparse.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6956,8 +6956,15 @@ bool post_process_mission(mission *pm)
69566956
for (i = 0; i < Briefings[team].num_stages; i++) {
69576957
const auto &stage = br[i];
69586958
for (int j = 0; j < stage.num_icons; j++) {
6959-
ship_info *sip = &Ship_info[stage.icons[j].ship_class];
6960-
stage.icons[j].modelnum = model_load(sip->pof_file, sip);
6959+
const auto& icon = stage.icons[j];
6960+
6961+
bool valid = SCP_vector_inbounds(Ship_info, icon.ship_class);
6962+
Assertion(valid, "Invalid ship class %d for briefing icon in stage %d", icon.ship_class, i);
6963+
6964+
if (valid) {
6965+
ship_info* sip = &Ship_info[icon.ship_class];
6966+
stage.icons[j].modelnum = model_load(sip->pof_file, sip);
6967+
}
69616968
}
69626969
}
69636970
}

0 commit comments

Comments
 (0)