Skip to content

Commit dd71838

Browse files
fix array index bug in ship_get_subsys_index (#6954)
1 parent b168547 commit dd71838

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

code/ship/ship.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15574,6 +15574,9 @@ int ship_get_subsys_index(const ship_subsys *subsys)
1557415574
if (subsys == nullptr)
1557515575
return -1;
1557615576

15577+
if (subsys->parent_objnum < 0)
15578+
return -1;
15579+
1557715580
// might need to refresh the cache
1557815581
auto sp = &Ships[Objects[subsys->parent_objnum].instance];
1557915582
if (!sp->flags[Ship::Ship_Flags::Subsystem_cache_valid])

0 commit comments

Comments
 (0)