From 9f97b7006d4cb66886b9273b7dbab011c02c7b04 Mon Sep 17 00:00:00 2001 From: Giorge Koulin Date: Tue, 1 Oct 2024 07:56:59 +0100 Subject: [PATCH] use `std::vector::data()` when setting GL data MSVC in Debug will throw "vector subscript out of range" error when calling `std::vector::operator[]` on empty vector. This will fail unit tests. Instead use `std::vector::data()` to retrieve data pointer. --- src/render/opengl/gl_engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/opengl/gl_engine.cpp b/src/render/opengl/gl_engine.cpp index bc5a70fa..477cdac9 100644 --- a/src/render/opengl/gl_engine.cpp +++ b/src/render/opengl/gl_engine.cpp @@ -264,7 +264,7 @@ void GLAttributeBuffer::setData_helper(const std::vector& data) { // do the actual copy dataSize = data.size(); - glBufferSubData(getTarget(), 0, dataSize * sizeof(T), &data[0]); + glBufferSubData(getTarget(), 0, dataSize * sizeof(T), data.data()); checkGLError(); }