diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index 741dc011e..acd99c3ff 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -603,7 +603,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec2* vectorAr UniformBinder binder(*this, name); if (binder.location != -1) - glCheck(GLEXT_glUniform2fv(binder.location, static_cast(length), &contiguous[0])); + glCheck(GLEXT_glUniform2fv(binder.location, static_cast(length), !contiguous.empty() ? &contiguous[0] : NULL)); } @@ -614,7 +614,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec3* vectorAr UniformBinder binder(*this, name); if (binder.location != -1) - glCheck(GLEXT_glUniform3fv(binder.location, static_cast(length), &contiguous[0])); + glCheck(GLEXT_glUniform3fv(binder.location, static_cast(length), !contiguous.empty() ? &contiguous[0] : NULL)); } @@ -625,7 +625,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec4* vectorAr UniformBinder binder(*this, name); if (binder.location != -1) - glCheck(GLEXT_glUniform4fv(binder.location, static_cast(length), &contiguous[0])); + glCheck(GLEXT_glUniform4fv(binder.location, static_cast(length), !contiguous.empty() ? &contiguous[0] : NULL)); } @@ -640,7 +640,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Mat3* matrixAr UniformBinder binder(*this, name); if (binder.location != -1) - glCheck(GLEXT_glUniformMatrix3fv(binder.location, static_cast(length), GL_FALSE, &contiguous[0])); + glCheck(GLEXT_glUniformMatrix3fv(binder.location, static_cast(length), GL_FALSE, !contiguous.empty() ? &contiguous[0] : NULL)); } @@ -655,7 +655,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Mat4* matrixAr UniformBinder binder(*this, name); if (binder.location != -1) - glCheck(GLEXT_glUniformMatrix4fv(binder.location, static_cast(length), GL_FALSE, &contiguous[0])); + glCheck(GLEXT_glUniformMatrix4fv(binder.location, static_cast(length), GL_FALSE, !contiguous.empty() ? &contiguous[0] : NULL)); }