Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ void LaserUpdate::initLaser( const Object *parent, const Coord3D *startPos, cons
{
system->setPosition( &m_startPos );
}
else
{
// Particle system no longer exists; clear the stale ID to prevent future access violations.
m_particleSystemID = INVALID_PARTICLE_SYSTEM_ID;
}
}
if( m_targetParticleSystemID )
{
Expand All @@ -299,6 +304,11 @@ void LaserUpdate::initLaser( const Object *parent, const Coord3D *startPos, cons
{
system->setPosition( &m_endPos );
}
else
{
// Particle system no longer exists; clear the stale ID to prevent future access violations.
m_targetParticleSystemID = INVALID_PARTICLE_SYSTEM_ID;
}
}

//Important! Set the laser position to the average of both points or else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C
{
system->setPosition( &m_startPos );
}
else
{
// Particle system no longer exists; clear the stale ID to prevent future access violations.
m_particleSystemID = INVALID_PARTICLE_SYSTEM_ID;
}
}

//PLEASE NOTE You cannot check an ID for nullptr. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though.
Expand All @@ -402,6 +407,11 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C
{
system->setPosition( &m_endPos );
}
else
{
// Particle system no longer exists; clear the stale ID to prevent future access violations.
m_targetParticleSystemID = INVALID_PARTICLE_SYSTEM_ID;
}
}

//Important! Set the laser position to the average of both points or else
Expand Down
Loading