diff options
-rw-r--r-- | source/blender/render/intern/source/render_texture.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 49bacbaf693..1e91738c77d 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -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; + } } } |