[Bf-blender-cvs] [d9f0885050c] greasepencil-refactor: Gpencil: Refactor: Overlay: Fix crash when no gpencil object is active
Clément Foucault
noreply at git.blender.org
Wed Jan 8 14:59:49 CET 2020
Commit: d9f0885050c8b0dff6c1745bd8737720724c7c1e
Author: Clément Foucault
Date: Tue Jan 7 22:34:53 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBd9f0885050c8b0dff6c1745bd8737720724c7c1e
Gpencil: Refactor: Overlay: Fix crash when no gpencil object is active
===================================================================
M source/blender/draw/engines/overlay/overlay_gpencil.c
===================================================================
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c
index c01794af1fc..a43d69741cb 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.c
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.c
@@ -57,11 +57,11 @@ void OVERLAY_edit_gpencil_cache_init(OVERLAY_Data *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
Object *ob = draw_ctx->obact;
- bGPdata *gpd = (bGPdata *)ob->data;
+ bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
Scene *scene = draw_ctx->scene;
ToolSettings *ts = scene->toolsettings;
- if (ob->type != OB_GPENCIL || gpd == NULL) {
+ if (gpd == NULL || ob->type != OB_GPENCIL) {
return;
}
@@ -152,12 +152,12 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
Object *ob = draw_ctx->obact;
- bGPdata *gpd = (bGPdata *)ob->data;
+ bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
Scene *scene = draw_ctx->scene;
ToolSettings *ts = scene->toolsettings;
const View3DCursor *cursor = &scene->cursor;
- if (ob->type != OB_GPENCIL || gpd == NULL) {
+ if (gpd == NULL || ob->type != OB_GPENCIL) {
return;
}
More information about the Bf-blender-cvs
mailing list