Fix: Potential crash in mesh comparison tests with mismatched attributes

Currently we allow the before/after meshes to have different
sets of attributes. But then we compare all attributes in each
mesh anyway, regardless of whether they exist or not.
This commit is contained in:
Hans Goudey
2024-09-25 15:22:07 -04:00
parent 504c1506b2
commit 90ec79992f

View File

@@ -522,6 +522,10 @@ static std::optional<MeshMismatch> verify_attributes_compatible(
for (const StringRef id : mesh1_attribute_ids) {
GAttributeReader reader1 = mesh1_attributes.lookup(id);
GAttributeReader reader2 = mesh2_attributes.lookup(id);
if (!reader1 || !reader2) {
/* Necessary because of previous disabled return. */
continue;
}
if (reader1.domain != reader2.domain || reader1.varray.type() != reader2.varray.type()) {
return MeshMismatch::AttributeTypes;
}