Fix T73553: Grease pencil poll crash with non-gpencil objects

This commit is contained in:
Campbell Barton 2020-02-03 15:16:38 +11:00
parent f51286cb8c
commit d243a0b03a
Notes: blender-bot 2023-02-14 03:03:03 +01:00
Referenced by issue #73553, Crash using Search Menu with Camera / Light selected
1 changed files with 2 additions and 4 deletions

View File

@ -273,12 +273,10 @@ bGPdata *ED_annotation_data_get_active_direct(ID *screen_id, ScrArea *sa, Scene
bGPdata *ED_gpencil_data_get_active(const bContext *C)
{
Object *ob = CTX_data_active_object(C);
if (ob == NULL) {
if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
return NULL;
}
bGPdata *gpd = (bGPdata *)ob->data;
return gpd;
return ob->data;
}
/* Get the active Grease Pencil datablock