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:
authorAntonio Vazquez <blendergit@gmail.com>2021-12-28 18:07:07 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-12-28 18:07:07 +0300
commitbd9d09ca829994ef30fb29debbb78612bdf9e3bd (patch)
tree5273740c147707f0d1725bc523a4040a00195cda /source/blender/editors/object
parent9bacd543124e6fb971842b3fbf0e03079f7da3d7 (diff)
Fix T94439: Some GPencil operators crash when calling from console
This fix avoid the segment fault for several operators.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_gpencil_modifier.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c
index e3c2932e17a..3fd11a101a5 100644
--- a/source/blender/editors/object/object_gpencil_modifier.c
+++ b/source/blender/editors/object/object_gpencil_modifier.c
@@ -968,6 +968,9 @@ static int dash_segment_add_exec(bContext *C, wmOperator *op)
DashGpencilModifierData *dmd = (DashGpencilModifierData *)gpencil_edit_modifier_property_get(
op, ob, eGpencilModifierType_Dash);
+ if (dmd == NULL) {
+ return OPERATOR_FINISHED;
+ }
const int new_active_index = dmd->segment_active_index + 1;
DashGpencilModifierSegment *new_segments = MEM_malloc_arrayN(
dmd->segments_len + 1, sizeof(DashGpencilModifierSegment), __func__);
@@ -1032,6 +1035,10 @@ static int dash_segment_remove_exec(bContext *C, wmOperator *op)
DashGpencilModifierData *dmd = (DashGpencilModifierData *)gpencil_edit_modifier_property_get(
op, ob, eGpencilModifierType_Dash);
+ if (dmd == NULL) {
+ return OPERATOR_FINISHED;
+ }
+
if (dmd->segment_active_index < 0 || dmd->segment_active_index >= dmd->segments_len) {
return OPERATOR_CANCELLED;
}
@@ -1108,6 +1115,10 @@ static int dash_segment_move_exec(bContext *C, wmOperator *op)
DashGpencilModifierData *dmd = (DashGpencilModifierData *)gpencil_edit_modifier_property_get(
op, ob, eGpencilModifierType_Dash);
+ if (dmd == NULL) {
+ return OPERATOR_FINISHED;
+ }
+
if (dmd->segments_len < 2) {
return OPERATOR_CANCELLED;
}