Check that all face indices of a mesh exist in the vertex array.
PiperOrigin-RevId: 532049715 Change-Id: Ic42f6ef49f136aa89fb83527db0867afa8be7f08
This commit is contained in:
committed by
Copybara-Service
parent
39723891ce
commit
871a2a7c8e
@@ -280,6 +280,13 @@ void mjCMesh::Compile(int vfs_provider) {
|
|||||||
throw mjCError(this, "face data must be a multiple of 3");
|
throw mjCError(this, "face data must be a multiple of 3");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check vertices exist
|
||||||
|
for (int i=0; i<userface.size(); i++) {
|
||||||
|
if (userface[i] >= nvert || userface[i] < 0) {
|
||||||
|
throw mjCError(this, "index in face does not exist in vertex array");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// create half-edge structure (if mesh was in XML)
|
// create half-edge structure (if mesh was in XML)
|
||||||
if (useredge.empty()) {
|
if (useredge.empty()) {
|
||||||
for (int i=0; i<userface.size()/3; i++) {
|
for (int i=0; i<userface.size()/3; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user