From d562587858d21899642831df9bce5b660ecdcc06 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 12 Jul 2019 17:00:20 +0100 Subject: [PATCH] Added check against any empty _segments to avoid undefined behaviour --- src/osgSim/ElevationSlice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osgSim/ElevationSlice.cpp b/src/osgSim/ElevationSlice.cpp index bdc4f193a..ce035742e 100644 --- a/src/osgSim/ElevationSlice.cpp +++ b/src/osgSim/ElevationSlice.cpp @@ -1092,6 +1092,8 @@ struct LineConstructor void copyPoints(ElevationSlice::Vec3dList& intersections, ElevationSlice::DistanceHeightList& distanceHeightIntersections) { + if (_segments.empty()) return; + SegmentSet::iterator prevItr = _segments.begin(); SegmentSet::iterator nextItr = prevItr; ++nextItr;