Skip to content

Commit

Permalink
fix, crash if ParticleSource.anchor isn't a Sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
AqeeAqee committed Aug 27, 2023
1 parent 1d3a16d commit 99c1b05
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions render_raycasting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,12 @@ namespace Render {
}
} else if(spr instanceof particles.ParticleSource){
const particle = (spr as particles.ParticleSource)
if (this.spriteParticles.indexOf(particle) < 0) {
this.spriteParticles[(particle.anchor as Sprite).id]=particle
particle.anchor=this.tempSprite
if (this.spriteParticles.indexOf(particle) < 0 && particle.anchor instanceof Sprite) {
const spr = (particle.anchor as Sprite)
if(this.sprites.indexOf(spr)>=0){
this.spriteParticles[spr.id]=particle
particle.anchor=this.tempSprite
}
}
} else {
if (this.spriteLikes.indexOf(spr) < 0)
Expand Down

0 comments on commit 99c1b05

Please sign in to comment.