fix for crash when psys_get_dupli_texture() was called on a subsurf mesh with simplify enabled.

This commit is contained in:
Campbell Barton
2010-07-12 20:35:10 +00:00
parent af06e281c0
commit 64091ff5bd

View File

@@ -4257,8 +4257,13 @@ void psys_get_dupli_texture(Object *ob, ParticleSettings *part, ParticleSystemMo
num= pa->num_dmcache;
if(num == DMCACHE_NOTFOUND)
if(pa->num < psmd->dm->getNumFaces(psmd->dm))
num= pa->num;
num= pa->num;
if (num >= psmd->dm->getNumFaces(psmd->dm)) {
/* happens when simplify is enabled
* gives invalid coords but would crash otherwise */
num= DMCACHE_NOTFOUND;
}
if(mtface && num != DMCACHE_NOTFOUND) {
mface= psmd->dm->getFaceData(psmd->dm, num, CD_MFACE);