diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index a83526a27..2db9a695f 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -462,9 +462,9 @@ template aiColor4D *GetVertexColorsForType(Ref input, std::vector *vertexRemappingTable) { constexpr float max = std::numeric_limits::max(); aiColor4t *colors; - input->ExtractData(colors, vertexRemappingTable); - auto output = new aiColor4D[input->count]; - for (size_t i = 0; i < input->count; i++) { + size_t count = input->ExtractData(colors, vertexRemappingTable); + auto output = new aiColor4D[count]; + for (size_t i = 0; i < count; i++) { output[i] = aiColor4D( colors[i].r / max, colors[i].g / max, colors[i].b / max, colors[i].a / max);