forked from bartvdbraak/blender
fix [#35500] Material Copy Crash on specific scenes
check material textures exist before using in a pasted material.
This commit is contained in:
parent
28937676f3
commit
2026e6a7b3
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user