From a5d0de0994f1985ac569c2ffa2c97460ad76938c Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 12 Mar 2022 20:07:44 +0100 Subject: [PATCH] Sketcher: Coverity 332695 - unlikely array indexing with negative value --- src/Mod/Sketcher/App/Sketch.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 963d14d0ea..827393b6b8 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -3478,9 +3478,12 @@ bool Sketch::updateGeometry() // Now we update the position of the points in the solver, so that any call to solve() // calculates constraints and positions based on the actual position of the knots. auto pointindex = getPointId(*it5, PointPos::start); - auto solverpoint = Points[pointindex]; - *(solverpoint.x) = pointcoords.x; - *(solverpoint.y) = pointcoords.y; + + if(pointindex >= 0) { + auto solverpoint = Points[pointindex]; + *(solverpoint.x) = pointcoords.x; + *(solverpoint.y) = pointcoords.y; + } } } }