Skip to content

Commit 72ccc4c

Browse files
committed
Error if asked to triangulate an empty mesh
This generally means an error happened earlier, but that still shouldn't lead to a segfault rather than a clean error message.
1 parent 399dc5f commit 72ccc4c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/mesh/poly2tri_triangulator.C

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,12 @@ void Poly2TriTriangulator::triangulate_current_points()
292292
std::vector<p2t::Point> outer_boundary_points;
293293
std::vector<std::vector<p2t::Point>> inner_hole_points(n_holes);
294294

295+
dof_id_type nn = _mesh.max_node_id();
296+
libmesh_error_msg_if
297+
(!nn, "Poly2TriTriangulator cannot triangulate an empty mesh!");
298+
295299
// Unless we're using an explicit segments list, we assume node ids
296300
// are contiguous here.
297-
dof_id_type nn = _mesh.max_node_id();
298301
if (this->segments.empty())
299302
libmesh_error_msg_if
300303
(_mesh.n_nodes() != nn,

0 commit comments

Comments
 (0)