[4.0] Fix UpdateRender if statement. 42/165742/2
authorminho.sun <minho.sun@samsung.com>
Wed, 3 Jan 2018 12:55:12 +0000 (21:55 +0900)
committerminho.sun <minho.sun@samsung.com>
Wed, 3 Jan 2018 23:52:01 +0000 (08:52 +0900)
Currently, TextVisual makes crash when doing UpdateRender because mAnimatableTextColorPropertyIndex is set to Property::INVALID_INDEX and this property only can be set by TextLabel.

TextVisual can be exist in other control like Buttons so change if
statement which uses mAnimatableTextColorPropertyIndex to get alpha
value.

Change-Id: I5ea04461584126e69490ccc513434200f5751755
Signed-off-by: minho.sun <minho.sun@samsung.com>
dali-toolkit/internal/visuals/text/text-visual.cpp

index fb45b54..faa0927 100755 (executable)
@@ -640,7 +640,12 @@ void TextVisual::UpdateRenderer()
   relayoutSize.height = floorf( 0.5f + ( isHeightRelative ? mImpl->mControlSize.height * mImpl->mTransform.mSize.y : mImpl->mTransform.mSize.height ) );
 
   float alpha = control.GetProperty< float >( Actor::Property::COLOR_ALPHA );
-  Vector4 animatableTextColor = control.GetProperty< Vector4 >( mAnimatableTextColorPropertyIndex );
+  Vector4 animatableTextColor = Color::WHITE;
+  if( mAnimatableTextColorPropertyIndex != Property::INVALID_INDEX )
+  {
+    animatableTextColor = control.GetProperty< Vector4 >( mAnimatableTextColorPropertyIndex );
+  }
+
   if( ( fabsf( relayoutSize.width ) < Math::MACHINE_EPSILON_1000 ) || ( fabsf( relayoutSize.height ) < Math::MACHINE_EPSILON_1000 )
       || mTypesetter->GetViewModel()->GetNumberOfLines() == 0 || alpha == 0.0f || animatableTextColor.a == 0.0f )
   {