diff --git a/src/pilot.c b/src/pilot.c index fd8fb69..ee4bb28 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -461,11 +461,12 @@ void pilot_hit(Pilot* p, const Solid* w, const unsigned int shooter, } } - /* Knock back effect is dependent on both damage and mass of the weapon. */ - /* should probably turn it into a partial conservative collision.. */ - vect_cadd(&p->solid->vel, - knockback * (w->vel.x * (dam_mod/6. + w->mass/p->solid->mass/6.)), - knockback * (w->vel.y * (dam_mod/6. + w->mass/p->solid->mass/6.))); + if(w != NULL) + /* Knock back effect is dependent on both damage and mass of the weapon. */ + /* should probably turn it into a partial conservative collision.. */ + vect_cadd(&p->solid->vel, + knockback * (w->vel.x * (dam_mod/6. + w->mass/p->solid->mass/6.)), + knockback * (w->vel.y * (dam_mod/6. + w->mass/p->solid->mass/6.))); } /**