[fixed]crash in CParticleAnimatedMeshSceneNodeEmitter::emitt

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
CuteAlien
Admin
Posts: 9735
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

[fixed]crash in CParticleAnimatedMeshSceneNodeEmitter::emitt

Post by CuteAlien »

In line 126 (current svn) in CParticleAnimatedMeshSceneNodeEmitter.cpp it can happen that a meshbuffer has no vertices (for example it's only used for a material). It will then crash because of doing modulo 0. Setting vertexNumber on 0 will also not help (it would crash a few lines later). So either we try to find a better meshbuffer in this case or we simply continue. I've done the latter here to avoid the crashes.

So instead of:

Code: Select all

u32 vertexNumber = os::Randomizer::rand() % frameMesh->getMeshBuffer(randomMB)->getVertexCount();
it would be:

Code: Select all

u32 vertexCount = frameMesh->getMeshBuffer(randomMB)->getVertexCount();
if ( !vertexCount )
	continue;
u32 vertexNumber = os::Randomizer::rand() % vertexCount;
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, fixed for both 1.4.x and trunk.
Post Reply