From 3926ea18ca4e09843e00c75f90c007fc9b7291a3 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 7 Apr 2019 07:44:13 +0200 Subject: [PATCH] V547 CWE-571 --- src/Mod/Sketcher/App/SketchObject.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 977c16ec56..17e563d6c6 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -5432,18 +5432,17 @@ const Part::Geometry* SketchObject::getGeometry(int GeoId) const Part::Geometry* projectLine(const BRepAdaptor_Curve& curve, const Handle(Geom_Plane)& gPlane, const Base::Placement& invPlm) { double first = curve.FirstParameter(); - bool infinite = false; + if (fabs(first) > 1E99) { // TODO: What is OCE's definition of Infinite? // TODO: The clean way to do this is to handle a new sketch geometry Geom::Line // but its a lot of work to implement... first = -10000; - //infinite = true; } + double last = curve.LastParameter(); if (fabs(last) > 1E99) { last = +10000; - //infinite = true; } gp_Pnt P1 = curve.Value(first); @@ -5465,16 +5464,11 @@ Part::Geometry* projectLine(const BRepAdaptor_Curve& curve, const Handle(Geom_Pl point->Construction = true; return point; } - else if (!infinite) { + else { Part::GeomLineSegment* line = new Part::GeomLineSegment(); line->setPoints(p1,p2); line->Construction = true; return line; - } else { - Part::GeomLine* line = new Part::GeomLine(); - line->setLine(p1, p2 - p1); - line->Construction = true; - return line; } }