From 213c0940df304955aa2b07ba15bcbe81b06d98ce Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 21 Jan 2025 19:38:40 +0100 Subject: [PATCH] Measure: Fix crash in Measurement::length() when selecting infinite edge (e.g. PD datum line) --- src/Mod/Measure/App/Measurement.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Mod/Measure/App/Measurement.cpp b/src/Mod/Measure/App/Measurement.cpp index bd68cd5d9c..784685b687 100644 --- a/src/Mod/Measure/App/Measurement.cpp +++ b/src/Mod/Measure/App/Measurement.cpp @@ -331,6 +331,9 @@ double Measurement::length() const // Get the length of one edge TopoDS_Shape shape = getShape(*obj, (*subEl).c_str(), TopAbs_EDGE); + if (shape.IsNull()) { + continue; + } const TopoDS_Edge& edge = TopoDS::Edge(shape); BRepAdaptor_Curve curve(edge); @@ -365,8 +368,8 @@ double Measurement::length() const throw Base::RuntimeError( "Measurement - length - Curve type not currently handled"); } - } // end switch - } // end for + } + } } } return result;