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
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-05 12:06:20 +0300
committerAntonioya <blendergit@gmail.com>2018-08-05 12:07:47 +0300
commit6d0835eca7e6bdec9f19bbb5fb194146225164c7 (patch)
tree97596a4d1bdc22dc73756f5ba715ca59b2acde6f /source/blender/makesrna/intern/rna_material.c
parent9a8541d0297beac9763c0afa53d4fc1d6853a1a9 (diff)
GP: Fix NULL pointer when preview is not ready
The preview cannot be ready when create a material with python
Diffstat (limited to 'source/blender/makesrna/intern/rna_material.c')
-rw-r--r--source/blender/makesrna/intern/rna_material.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 56f5a12516b..b6250a81b3b 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -114,10 +114,11 @@ static void rna_MaterialGpencil_update(Main *bmain, Scene *scene, PointerRNA *pt
rna_Material_update(bmain, scene, ptr);
/* update previews (icon and thumbnail) */
- preview->flag[ICON_SIZE_ICON] |= PRV_CHANGED;
- preview->flag[ICON_SIZE_PREVIEW] |= PRV_CHANGED;
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma);
-
+ if (preview != NULL) {
+ preview->flag[ICON_SIZE_ICON] |= PRV_CHANGED;
+ preview->flag[ICON_SIZE_PREVIEW] |= PRV_CHANGED;
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma);
+ }
WM_main_add_notifier(NC_GPENCIL | ND_DATA, ma);
}