[Fix] Killed chances of possible seg fault.

This commit is contained in:
Allanis 2014-03-07 23:23:55 +00:00
parent 812321b07d
commit 108d4f1c72

View File

@ -457,7 +457,7 @@ void pilot_hit(Pilot* p, const Solid* w, const unsigned int shooter,
pilot_dead(p); pilot_dead(p);
/* Adjust the combat rating based on pilot mass and ditto faction. */ /* Adjust the combat rating based on pilot mass and ditto faction. */
pshooter = pilot_get(shooter); pshooter = pilot_get(shooter);
if(pshooter->faction == FACTION_PLAYER) { if((pshooter != NULL) && (pshooter->faction == FACTION_PLAYER)) {
mod = sqrt(p->ship->mass) / 5; mod = sqrt(p->ship->mass) / 5;
player_crating += 2*mod; /* Crating chanes faster. */ player_crating += 2*mod; /* Crating chanes faster. */
faction_modPlayer(p->faction, -mod); faction_modPlayer(p->faction, -mod);