diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-25 04:23:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-25 04:23:23 +0400 |
commit | 2026e6a7b3f1aa94a61ea03bdbc9ede6cdc1b55a (patch) | |
tree | 9d64052b2c779a2f504cdf7ff2242d1807edb5d6 /source/blender/blenkernel | |
parent | 28937676f303dfa64150dc09ac14d1efc1893a3a (diff) |
fix [#35500] Material Copy Crash on specific scenes
check material textures exist before using in a pasted material.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 2b7a41933b4..c8cd65e9477 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1597,7 +1597,15 @@ void paste_matcopybuf(Material *ma) mtex = ma->mtex[a]; if (mtex) { ma->mtex[a] = MEM_dupallocN(mtex); - if (mtex->tex) id_us_plus((ID *)mtex->tex); + if (mtex->tex) { + /* first check this is in main (we may have loaded another file) [#35500] */ + if (BLI_findindex(&G.main->tex, mtex->tex) != -1) { + id_us_plus((ID *)mtex->tex); + } + else { + ma->mtex[a]->tex = NULL; + } + } } } |