[Bf-blender-cvs] [d243a0b03a9] blender-v2.82-release: Fix T73553: Grease pencil poll crash with non-gpencil objects

Campbell Barton noreply at git.blender.org
Mon Feb 3 05:26:14 CET 2020


Commit: d243a0b03a9ff80385a77342a55e2d99cb2eec98
Author: Campbell Barton
Date:   Mon Feb 3 15:16:38 2020 +1100
Branches: blender-v2.82-release
https://developer.blender.org/rBd243a0b03a9ff80385a77342a55e2d99cb2eec98

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

===================================================================

M	source/blender/editors/gpencil/gpencil_utils.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 9b1551fe2a5..4e4ec274a39 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -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



More information about the Bf-blender-cvs mailing list