diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-01-17 00:59:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-17 00:59:02 +0300 |
commit | e57ee5934a30e87410b7544ba8d18054881b2c00 (patch) | |
tree | b111017497b1a074462f9d9e8a6d80c3250499d7 /source/blender/blenkernel/intern/material.c | |
parent | dfb63653f4f084ec8c8b061dd0f33769b16b3b91 (diff) |
Fix T60261: Crash pasting a material without a nodetree
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 913bc9c47e6..fc03116de20 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1399,7 +1399,10 @@ void copy_matcopybuf(Main *bmain, Material *ma) memcpy(&matcopybuf, ma, sizeof(Material)); - matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false); + if (ma->nodetree != NULL) { + matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false); + } + matcopybuf.preview = NULL; BLI_listbase_clear(&matcopybuf.gpumaterial); /* TODO Duplicate Engine Settings and set runtime to NULL */ @@ -1425,7 +1428,9 @@ void paste_matcopybuf(Main *bmain, Material *ma) memcpy(ma, &matcopybuf, sizeof(Material)); (ma->id) = id; - ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false); + if (matcopybuf.nodetree != NULL) { + ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false); + } } void BKE_material_eval(struct Depsgraph *depsgraph, Material *material) |