[Bf-blender-cvs] [d7c556de32f] master: GPencil: Avoid crashes calling from python

Antonio Vazquez noreply at git.blender.org
Tue Dec 28 18:50:11 CET 2021


Commit: d7c556de32f2cb8c90e8be0943cd6c1f8169e4de
Author: Antonio Vazquez
Date:   Tue Dec 28 18:49:42 2021 +0100
Branches: master
https://developer.blender.org/rBd7c556de32f2cb8c90e8be0943cd6c1f8169e4de

GPencil: Avoid crashes calling from python

This is part of T94439

===================================================================

M	source/blender/editors/gpencil/gpencil_data.c
M	source/blender/editors/object/object_gpencil_modifier.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index bea8126cfcc..916aa8184aa 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1468,6 +1468,10 @@ static int gpencil_layer_change_invoke(bContext *C, wmOperator *op, const wmEven
 static int gpencil_layer_change_exec(bContext *C, wmOperator *op)
 {
   bGPdata *gpd = CTX_data_gpencil_data(C);
+  if (gpd == NULL) {
+    return OPERATOR_CANCELLED;
+  }
+
   bGPDlayer *gpl = NULL;
   int layer_num = RNA_enum_get(op->ptr, "layer");
 
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c
index 3fd11a101a5..f9ad35d261d 100644
--- a/source/blender/editors/object/object_gpencil_modifier.c
+++ b/source/blender/editors/object/object_gpencil_modifier.c
@@ -533,6 +533,10 @@ static GpencilModifierData *gpencil_edit_modifier_property_get(wmOperator *op,
                                                                Object *ob,
                                                                int type)
 {
+  if (ob == NULL) {
+    return NULL;
+  }
+
   char modifier_name[MAX_NAME];
   GpencilModifierData *md;
   RNA_string_get(op->ptr, "modifier", modifier_name);



More information about the Bf-blender-cvs mailing list