From f0b6d57482f3b069a592737ab55867f86e090ce2 Mon Sep 17 00:00:00 2001 From: David Steele Date: Thu, 18 Dec 2014 19:10:54 +0000 Subject: [PATCH] Fixed shader compilation error handling Dali::Vector cannot use operator[0] after a Reserve (it asserts), unlike std::vector. Changed error handling to use Begin() instead, which returns a pointer to the reserved memory without asserting. Fixed exception handling, which uses the same string without the length check. Change-Id: I2e0131aec6cec209f27ef0ea7f903c718cbc4193 Signed-off-by: David Steele --- dali/internal/render/shaders/program.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 8b145fc..1ef2600 100644 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -588,17 +588,17 @@ bool Program::CompileShader( GLenum shaderType, GLuint& shaderId, const char* sr DALI_LOG_ERROR("Failed to compile shader\n"); LogWithLineNumbers(src); - Dali::Vector< char > szLog; GLint nLength; mGlAbstraction.GetShaderiv( shaderId, GL_INFO_LOG_LENGTH, &nLength); if(nLength > 0) { + Dali::Vector< char > szLog; szLog.Reserve( nLength ); - mGlAbstraction.GetShaderInfoLog( shaderId, nLength, &nLength, &szLog[ 0 ] ); - DALI_LOG_ERROR( "Shader Compiler Error: %s\n", &szLog[ 0 ] ); + mGlAbstraction.GetShaderInfoLog( shaderId, nLength, &nLength, szLog.Begin() ); + DALI_LOG_ERROR( "Shader Compiler Error: %s\n", szLog.Begin() ); } - throw DaliException( "Shader compilation failure", &szLog[ 0 ] ); + DALI_ASSERT_ALWAYS( 0 && "Shader compilation failure" ); } return compiled != 0; -- 2.7.4