[Fix] Turrets causing seg fault when there is no target.
This commit is contained in:
parent
284823ce25
commit
0277fcc750
@ -406,7 +406,8 @@ static Weapon* weapon_create(const Outfit* outfit, const double dir, const Vec2*
|
||||
case OUTFIT_TYPE_BOLT:
|
||||
case OUTFIT_TYPE_TURRET_BOLT:
|
||||
/* Only difference is the direction of fire. */
|
||||
if((outfit->type == OUTFIT_TYPE_TURRET_BOLT) && (w->parent != w->target)) {
|
||||
if((outfit->type == OUTFIT_TYPE_TURRET_BOLT) && (w->parent != w->target) &&
|
||||
(w->target != 0)) { /* Must have a valid target. */
|
||||
rdir = vect_angle(pos, &pilot_get(w->target)->solid->pos);
|
||||
rdir += RNG(-outfit->u.blt.accuracy/2.,
|
||||
outfit->u.blt.accuracy/2.)/180.*M_PI;
|
||||
|
Loading…
Reference in New Issue
Block a user