diff --git a/src/Magnum/MeshTools/Duplicate.h b/src/Magnum/MeshTools/Duplicate.h index 4d67ab583..7ba7772c2 100644 --- a/src/Magnum/MeshTools/Duplicate.h +++ b/src/Magnum/MeshTools/Duplicate.h @@ -30,6 +30,7 @@ */ #include +#include #include "Magnum/Types.h" @@ -45,8 +46,10 @@ index array `{1, 1, 0, 3, 2, 2}` will be converted to `{b, b, a, d, c, c}`. template std::vector duplicate(const std::vector& indices, const std::vector& data) { std::vector out; out.reserve(indices.size()); - for(const UnsignedInt index: indices) + for(const UnsignedInt index: indices) { + CORRADE_ASSERT(index < data.size(), "MeshTools::duplicate(): index out of range", out); out.push_back(data[index]); + } return out; }