Skip to content

Commit 319e573

Browse files
authored
1 parent 83f0829 commit 319e573

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

code/ship/shipfx.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ static void shipfx_maybe_create_live_debris_at_ship_death( object *ship_objp )
235235
for (auto pss: list_range(&shipp->subsys_list)) {
236236
if (pss->system_info != nullptr) {
237237
int submodel_num = pss->system_info->subobj_num;
238+
239+
// Subsystems without a valid submodel cannot produce live debris
240+
if (submodel_num < 0 || submodel_num >= pm->n_models) {
241+
continue;
242+
}
243+
238244
// find the submodels which aren't already blown up and have live debris
239245
if (!pmi->submodel[submodel_num].blown_off && pm->submodel[submodel_num].num_live_debris > 0) {
240246
vec3d exp_center, tmp = ZERO_VECTOR;

0 commit comments

Comments
 (0)