diff --git a/Libs/Mesh/MeshUtils.cpp b/Libs/Mesh/MeshUtils.cpp index 3f2166060d..e3e3f91cfd 100644 --- a/Libs/Mesh/MeshUtils.cpp +++ b/Libs/Mesh/MeshUtils.cpp @@ -1120,6 +1120,12 @@ vtkSmartPointer MeshUtils::recreate_mesh(vtkSmartPointer MeshUtils::repair_mesh(vtkSmartPointer mesh, bool extract_largest) { + // Line-only / vertex-only polydata (e.g. contours) has no polygons to repair; + // the triangulation and cleanup steps below would discard its cells. + if (mesh->GetNumberOfPolys() == 0) { + return mesh; + } + auto triangle_filter = vtkSmartPointer::New(); triangle_filter->SetInputData(mesh); triangle_filter->PassLinesOff();