Fix #30413: dynamic paint crash with texture slots with no texture assigned.

This commit is contained in:
Brecht Van Lommel
2012-03-01 20:41:13 +00:00
parent 9aafe32147
commit 2942eab57c

View File

@@ -3556,6 +3556,8 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
if(mat->mtex[tex_nr]) {
MTex *mtex = mat->mtex[tex_nr];
if(!mtex->tex) continue;
/* only keep compatible texflags */
mtex->texflag = mtex->texflag & (MTEX_RGBTOINT | MTEX_STENCIL | MTEX_NEGATIVE | MTEX_ALPHAMIX);
@@ -3629,9 +3631,12 @@ void RE_free_sample_material(Material *mat)
if(mat->septex & (1<<tex_nr)) continue;
if(mat->mtex[tex_nr]) {
MTex *mtex= mat->mtex[tex_nr];
free_texture(mtex->tex);
MEM_freeN(mtex->tex);
mtex->tex = NULL;
if(mtex->tex) {
free_texture(mtex->tex);
MEM_freeN(mtex->tex);
mtex->tex = NULL;
}
}
}