From: Heeyong Song Date: Thu, 1 Apr 2021 01:40:05 +0000 (+0900) Subject: [Tizen] Fix Coverity issue X-Git-Tag: accepted/tizen/unified/20210402.004928~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F83%2F256283%2F1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git [Tizen] Fix Coverity issue Change-Id: I364b7dc968fbf3c3b6707d9f8b233f058710c484 --- diff --git a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp index 43420ad..2213fc0 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp @@ -219,19 +219,25 @@ void Reflection::BuildUniformReflection() } else { - uint32_t previousUniformLocation = mDefaultUniformBlock.members[i - 1].location; - auto previousUniform = std::find_if(mStandaloneUniformExtraInfos.begin(), mStandaloneUniformExtraInfos.end(), [&previousUniformLocation](const UniformExtraInfo& iter) { return iter.location == previousUniformLocation; }); - mDefaultUniformBlock.members[i].offset = mDefaultUniformBlock.members[i - 1].offset + (previousUniform->size * previousUniform->arraySize); - mStandaloneUniformExtraInfos[i].offset = mDefaultUniformBlock.members[i].offset; + uint32_t previousUniformLocation = mDefaultUniformBlock.members[i - 1].location; + auto previousUniform = std::find_if(mStandaloneUniformExtraInfos.begin(), mStandaloneUniformExtraInfos.end(), [&previousUniformLocation](const UniformExtraInfo& iter) { return iter.location == previousUniformLocation; }); + if(previousUniform != mStandaloneUniformExtraInfos.end()) + { + mDefaultUniformBlock.members[i].offset = mDefaultUniformBlock.members[i - 1].offset + (previousUniform->size * previousUniform->arraySize); + mStandaloneUniformExtraInfos[i].offset = mDefaultUniformBlock.members[i].offset; + } } } if(mDefaultUniformBlock.members.size() > 0) { - uint32_t lastUniformLocation = mDefaultUniformBlock.members.back().location; - auto lastUniform = std::find_if(mStandaloneUniformExtraInfos.begin(), mStandaloneUniformExtraInfos.end(), [&lastUniformLocation](const UniformExtraInfo& iter) { return iter.location == lastUniformLocation; }); - mDefaultUniformBlock.size = mDefaultUniformBlock.members.back().offset + (lastUniform->size * lastUniform->arraySize); - mUniformBlocks.push_back(mDefaultUniformBlock); + uint32_t lastUniformLocation = mDefaultUniformBlock.members.back().location; + auto lastUniform = std::find_if(mStandaloneUniformExtraInfos.begin(), mStandaloneUniformExtraInfos.end(), [&lastUniformLocation](const UniformExtraInfo& iter) { return iter.location == lastUniformLocation; }); + if(lastUniform != mStandaloneUniformExtraInfos.end()) + { + mDefaultUniformBlock.size = mDefaultUniformBlock.members.back().offset + (lastUniform->size * lastUniform->arraySize); + mUniformBlocks.push_back(mDefaultUniformBlock); + } } else { @@ -285,6 +291,12 @@ void Reflection::BuildUniformBlockReflection() GLenum type; gl->GetActiveUniform(glProgram, uniIndex, maxUniLen, &length, &size, &type, uniformName); + + if(!uniformName) + { + continue; + } + int location = gl->GetUniformLocation(glProgram, uniformName); Dali::Graphics::UniformInfo uniform;