GPencil: Avoid crashes calling from python

This is part of T94439
This commit is contained in:
Antonio Vazquez 2021-12-28 18:49:42 +01:00
parent 2e6ae11326
commit d7c556de32
2 changed files with 8 additions and 0 deletions

View File

@ -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");

View File

@ -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);