Skip to content

Commit

Permalink
Don't crash when the lassat fires.
Browse files Browse the repository at this point in the history
Return 1000 in checkFireLine (the same as when source and target position are
the same, in line 1009) when psViewer is NULL. Closes #2229.
  • Loading branch information
cybersphinx committed Oct 18, 2010
1 parent 5bb1b88 commit a32651d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/visibility.c
Expand Up @@ -975,7 +975,12 @@ static int checkFireLine(const BASE_OBJECT* psViewer, const BASE_OBJECT* psTarge
int distSq, partSq, oldPartSq;
double angletan;

ASSERT_OR_RETURN(-1, psViewer || psTarget, "Invalid shooter pointer!");
ASSERT_OR_RETURN(-1, psTarget, "Invalid target pointer!");
if (!psViewer)
{
// lassat always has a line of sight
return 1000;
}

// get muzzle offset (code from projectile.c)
if (psViewer->type == OBJ_DROID && weapon_slot >= 0)
Expand Down

0 comments on commit a32651d

Please sign in to comment.