diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-09-21 08:02:17 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-09-21 08:03:45 +0300 |
commit | 586c58902d9b1b1edc417728aa3e357c1e66d3a8 (patch) | |
tree | 96436bb45282052200d96101dbd05b5a5a433f42 /source/blender/editors/gpencil/gpencil_brush.c | |
parent | 0b9cfbf6a8d1102aa00d926d649f5866fcb4c91f (diff) |
Fix: Grease Pencil sculpting crashes when sculpting on layers without any strokes
Reported by @loochmunz. I've also gone through checking for and fixing other places
where this was also occurring.
To be included in 2.78
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_brush.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_brush.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index fcb2ce02bde..8576cbca239 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1350,6 +1350,10 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso) CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { + bGPDframe *gpf = gpl->actframe; + if (gpf == NULL) + continue; + /* calculate difference matrix if parent object */ if (gpl->parent != NULL) { ED_gpencil_parent_location(gpl, diff_mat); @@ -1358,10 +1362,8 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso) else { parented = false; } - - bGPDframe *gpf = gpl->actframe; - bGPDstroke *gps; - for (gps = gpf->strokes.first; gps; gps = gps->next) { + + for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { /* skip strokes that are invalid for current view */ if (ED_gpencil_stroke_can_use(C, gps) == false) continue; |