Commit 848f551e authored by Philip Trettner's avatar Philip Trettner
Browse files

check against sampling from empty valid collection

parent f64d95b5
......@@ -568,8 +568,11 @@ typename primitive<tag>::handle smart_collection<mesh_ptr, tag, iterator>::rando
typename primitive<tag>::handle h = {this->m, typename primitive<tag>::index(int(g() % s))};
if constexpr (iterator::is_valid_only_iterator)
POLYMESH_ASSERT(primitive<tag>::valid_size(*this->m) > 0 && "Cannot chose from empty mesh");
while (h.is_removed())
h = {this->m, typename primitive<tag>::index(int(g() % s))};
return h;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment