diff --git a/code/ai/aiturret.cpp b/code/ai/aiturret.cpp index 974e37557f4..b71a3736ff0 100644 --- a/code/ai/aiturret.cpp +++ b/code/ai/aiturret.cpp @@ -1095,7 +1095,8 @@ int find_turret_enemy(const ship_subsys *turret_subsys, int objnum, const vec3d int target_objnum = aip->target_objnum; if (Objects[target_objnum].signature == aip->target_signature) { - ship* target_shipp = &Ships[Objects[target_objnum].instance]; + // The parent's target can be a weapon or an asteroid, so make sure it's a ship before indexing Ships[] + ship* target_shipp = (Objects[target_objnum].type == OBJ_SHIP) ? &Ships[Objects[target_objnum].instance] : nullptr; if (target_shipp && iff_matches_mask(target_shipp->team, enemy_team_mask)) { if (!(Objects[target_objnum].flags[Object::Object_Flags::Protected])) { // check this flag as well // nprintf(("AI", "Frame %i: Object %i resuming goal of object %i\n", AI_FrameCount, objnum, diff --git a/code/ship/ship.cpp b/code/ship/ship.cpp index 799c8c09d45..a7433f8b076 100644 --- a/code/ship/ship.cpp +++ b/code/ship/ship.cpp @@ -4336,7 +4336,7 @@ static void parse_ship_values(ship_info* sip, const bool is_template, const bool float help_hull_val; stuff_float(&help_hull_val); if (help_hull_val > 0.0f && help_hull_val <= 1.0f) { - sip->ask_help_shield_percent = help_hull_val; + sip->ask_help_hull_percent = help_hull_val; } else { error_display(0,"Ask Help Hull Percent for ship class %s is %f. This value is not within range of 0-1.0." "Assuming default value of %f.", sip->name, help_hull_val, DEFAULT_ASK_HELP_HULL_PERCENT);