Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-05-25 04:23:23 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-25 04:23:23 +0400
commit2026e6a7b3f1aa94a61ea03bdbc9ede6cdc1b55a (patch)
tree9d64052b2c779a2f504cdf7ff2242d1807edb5d6 /source
parent28937676f303dfa64150dc09ac14d1efc1893a3a (diff)
fix [#35500] Material Copy Crash on specific scenes
check material textures exist before using in a pasted material.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/material.c10
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;
+ }
+ }
}
}