diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h index 2abd60700ad..52faa515f57 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h @@ -1564,15 +1564,16 @@ private: case Cone_tree_node::EDGE_SOURCE: { Segment_2 entrySegment = current->entry_segment(); - Ray_2 rayToLocation(construct_ray_2(current->source_image(), currentLocation)); + Point_2 currentSourceImage = current->source_image(); + Ray_2 rayToLocation(construct_ray_2(currentSourceImage, currentLocation)); LineLineIntersectResult cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation)); CGAL_assertion(bool(cgalIntersection)); - Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = boost::get(&*cgalIntersection); - CGAL_assertion(result && "Error, did not get point intersection on path walk to source"); + if (!result) result = ¤tSourceImage; FT t0 = parametric_distance_along_segment_2(construct_source_2(entrySegment), construct_target_2(entrySegment), *result);