Skip to content

Commit

Permalink
fixed occasional division through zero after recent commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimaryFeather committed Sep 18, 2018
1 parent 47896b9 commit d946df3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/starling/extensions/ParticleSystem.as
Expand Up @@ -248,8 +248,11 @@ package starling.extensions
var timeBetweenParticles:Number = 1.0 / _emissionRate;

// if we'd exceed capacity, lower spawn rate
if (_numParticles + (_frameTime / timeBetweenParticles) > maxNumParticles)
if (_numParticles < maxNumParticles &&
_numParticles + (_frameTime / timeBetweenParticles) > maxNumParticles)
{
timeBetweenParticles = _frameTime / (maxNumParticles - _numParticles);
}

while (_frameTime > 0)
{
Expand Down

0 comments on commit d946df3

Please sign in to comment.