From 70ce11d640e0a85c863db08f269167a75c0eb251 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 21 Jan 2014 16:45:31 +0100 Subject: Minor cleanup from latest coverity checks - if we have a previous curve, we can safely assume we also have a previous stroke! Better to assert here, than checking this randomly... --- source/blender/editors/gpencil/gpencil_edit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/gpencil') diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 09cfcf5256f..5d992824e3b 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -921,6 +921,8 @@ static void gp_stroke_to_path(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Curv float p1[3], p2[3], p[3], next_p[3]; float dt1 = 0.0f, dt2 = 0.0f; + BLI_assert(gps->prev != NULL); + prev_bp = NULL; if ((old_nbp > 1) && (gps->prev->totpoints > 1)) { /* Only use last curve segment if previous stroke was not a single-point one! */ @@ -1128,6 +1130,8 @@ static void gp_stroke_to_bezier(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cu /* If needed, make the link between both strokes with two zero-radius additional points */ if (curnu && old_nbezt) { + BLI_assert(gps->prev != NULL); + /* Update last point's second handle */ if (stitch) { bezt = &nu->bezt[old_nbezt - 1]; @@ -1150,7 +1154,7 @@ static void gp_stroke_to_bezier(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cu float dt1 = 0.0f, dt2 = 0.0f; prev_bezt = NULL; - if (old_nbezt > 1 && gps->prev && gps->prev->totpoints > 1) { + if ((old_nbezt > 1) && (gps->prev->totpoints > 1)) { /* Only use last curve segment if previous stroke was not a single-point one! */ prev_bezt = &nu->bezt[old_nbezt - 2]; } -- cgit v1.2.3