Skip to content

Commit

Permalink
Particles|Fixed: Crash due to null pointer access
Browse files Browse the repository at this point in the history
Some of the particles created by the "lightning" hit effect didn't have
a current sector set, presumably because they were being spawned
outside the map.

Bug report: http://sourceforge.net/tracker/?func=detail&aid=3496963&group_id=74815&atid=542099#
  • Loading branch information
skyjake committed Mar 14, 2012
1 parent 97825f9 commit 1edc4a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/p_particle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ static void P_MoveParticle(ptcgen_t* gen, particle_t* pt)

// Check the new Z position only if not stuck to a plane.
z = pt->pos[VZ] + pt->mov[VZ];
if(pt->pos[VZ] != DDMININT && pt->pos[VZ] != DDMAXINT)
if(pt->pos[VZ] != DDMININT && pt->pos[VZ] != DDMAXINT && pt->sector)
{
if(z > FLT2FIX(pt->sector->SP_ceilheight) - hardRadius)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/rend_particle.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static boolean populateSortBuffer(ptcgen_t* gen, void* context)
float dist;
porder_t* slot;

if(pt->stage < 0)
if(pt->stage < 0 || !pt->sector)
continue;

// Is the particle's sector visible?
Expand Down

0 comments on commit 1edc4a6

Please sign in to comment.