diff --git a/BGL/include/CGAL/boost/graph/copy_face_graph.h b/BGL/include/CGAL/boost/graph/copy_face_graph.h index c396484f4ed..19755ac8e46 100644 --- a/BGL/include/CGAL/boost/graph/copy_face_graph.h +++ b/BGL/include/CGAL/boost/graph/copy_face_graph.h @@ -167,6 +167,8 @@ void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, for(tm_vertex_descriptor v : vertices(tm)) { tm_halfedge_descriptor h = halfedge(v, tm); + if (h==boost::graph_traits::null_halfedge()) + continue; tm_halfedge_descriptor next_around_vertex=h; do{ next_around_vertex=opposite(next(next_around_vertex, tm), tm); diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index 0711cf379ed..6e9418c8ca8 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -35,6 +35,57 @@ test_copy_face_graph_nm_umbrella() } } +template +void +test_copy_face_graph_isolated_vertices() +{ + typedef Kernel::Point_3 Point_3; + + { + T s, t; + add_vertex(s); + CGAL::copy_face_graph(s, t); + } + + { + T s, t; + add_vertex(t); + CGAL::copy_face_graph(s, t); + } + + { + T s, t; + CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s); + add_vertex(s); + t=s; + CGAL::copy_face_graph(s, t); + } + + { + T s, t; + CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s); + add_vertex(s); + add_vertex(t); + CGAL::copy_face_graph(s, t); + } + + { + T s, t; + CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s); + add_vertex(s); + t=s; + CGAL::copy_face_graph(s, t); + } + + { + T s, t; + CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s); + add_vertex(s); + add_vertex(t); + CGAL::copy_face_graph(s, t); + } +} + template void join_face_test() @@ -619,6 +670,7 @@ void test_Euler_operations() { test_copy_face_graph_nm_umbrella(); + test_copy_face_graph_isolated_vertices(); join_face_test(); add_vertex_and_face_to_border_test(); add_face_to_border_test();