diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-12-28 20:49:42 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-12-28 20:50:07 +0300 |
commit | d7c556de32f2cb8c90e8be0943cd6c1f8169e4de (patch) | |
tree | 400c54b6ddd3419bf50f4d7da75fe9880e86195d | |
parent | 2e6ae113263d429ca3c933a5e869a48c81994867 (diff) |
GPencil: Avoid crashes calling from python
This is part of T94439
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_gpencil_modifier.c | 4 |
2 files changed, 8 insertions, 0 deletions
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); |