[Bf-blender-cvs] [70ce11d] master: Minor cleanup from latest coverity checks - if we have a previous curve, we can safely assume we also have a previous stroke!
Bastien Montagne
noreply at git.blender.org
Tue Jan 21 16:46:27 CET 2014
Commit: 70ce11d640e0a85c863db08f269167a75c0eb251
Author: Bastien Montagne
Date: Tue Jan 21 16:45:31 2014 +0100
https://developer.blender.org/rB70ce11d640e0a85c863db08f269167a75c0eb251
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...
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 09cfcf5..5d99282 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];
}
More information about the Bf-blender-cvs
mailing list