diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp index 067c3dc27e82053ded7a6152cf1eef78aecf6a18..06b317b5df590d2166305fc64c1c4faf762da9c0 100644 --- a/MeshLib/Mesh.cpp +++ b/MeshLib/Mesh.cpp @@ -269,11 +269,19 @@ void scaleMeshPropertyVector(MeshLib::Mesh& mesh, PropertyVector<int> const* materialIDs(Mesh const& mesh) { auto const& properties = mesh.getProperties(); - return properties.existsPropertyVector<int>("MaterialIDs", - MeshLib::MeshItemType::Cell, 1) - ? properties.getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1) - : nullptr; + if (properties.existsPropertyVector<int>("MaterialIDs", + MeshLib::MeshItemType::Cell, 1)) + { + return properties.getPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1); + } + if (properties.hasPropertyVector("MaterialIDs")) + { + WARN( + "The 'MaterialIDs' mesh property exists but is either of wrong " + "type (must be int), or it is not defined on element / cell data."); + } + return nullptr; } std::unique_ptr<MeshLib::Mesh> createMeshFromElementSelection(