diff --git a/extensions/Particle3D/ParticleUniverse/ParticleRenders/CCPUParticle3DRender.cpp b/extensions/Particle3D/ParticleUniverse/ParticleRenders/CCPUParticle3DRender.cpp index 0b1fed8b30..c2494295e2 100644 --- a/extensions/Particle3D/ParticleUniverse/ParticleRenders/CCPUParticle3DRender.cpp +++ b/extensions/Particle3D/ParticleUniverse/ParticleRenders/CCPUParticle3DRender.cpp @@ -387,7 +387,12 @@ void PUParticle3DModelRender::render( Renderer* renderer, const Mat4 &transform, if (_spriteList.empty()){ for (unsigned int i = 0; i < particleSystem->getParticleQuota(); ++i){ - Sprite3D *sprite = Sprite3D::create(_modelFile); + auto sprite = Sprite3D::create(_modelFile); + if (sprite == nullptr) + { + CCLOG("failed to load file %s", _modelFile.c_str()); + continue; + } sprite->setTexture(_texFile); sprite->retain(); _spriteList.push_back(sprite); @@ -433,7 +438,10 @@ PUParticle3DModelRender::PUParticle3DModelRender() PUParticle3DModelRender::~PUParticle3DModelRender() { - + for (auto it : _spriteList) { + it->release(); + } + _spriteList.clear(); } NS_CC_END