Fix #128789: GPv3: Context property missing nullptr check

`grease_pencil` context property has to check for valid active object.
Added in 70c7fb6da2

Pull Request: https://projects.blender.org/blender/blender/pulls/128791
This commit is contained in:
Lukas Tönne
2024-10-09 12:22:51 +02:00
parent 5c57e24fea
commit 12b4ac87ea

View File

@@ -855,7 +855,7 @@ static eContextResult screen_ctx_grease_pencil_data(const bContext *C, bContextD
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
BKE_view_layer_synced_ensure(scene, view_layer);
Object *obact = BKE_view_layer_active_object_get(view_layer);
if (obact->type == OB_GREASE_PENCIL) {
if (obact && obact->type == OB_GREASE_PENCIL) {
GreasePencil *grease_pencil = static_cast<GreasePencil *>(obact->data);
CTX_data_id_pointer_set(result, &grease_pencil->id);
return CTX_RESULT_OK;