Commit fbb3e4230389ffa6f2acb4b2ff3e9ceaa8583a66

Authored by Adeel Kazmi
1 parent f6f1baca

(AnimatedVectorImages) Fixed SVACE error

Ensure we check that the value was actually found in the map before we
dereference it.

Change-Id: Ib772c9b0812eeb3123e734888eab467ee7f83d58
examples/animated-vector-images/animated-vector-images-example.cpp
1 /* 1 /*
2 - * Copyright (c) 2018 Samsung Electronics Co., Ltd. 2 + * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
@@ -157,17 +157,20 @@ private: @@ -157,17 +157,20 @@ private:
157 Property::Map map = imageView.GetProperty< Property::Map >( ImageView::Property::IMAGE ); 157 Property::Map map = imageView.GetProperty< Property::Map >( ImageView::Property::IMAGE );
158 Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE ); 158 Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE );
159 159
160 - if( value->Get< int >() != static_cast< int >( DevelImageVisual::PlayState::PLAYING ) ) 160 + if( value )
161 { 161 {
162 - mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Pause" ); 162 + if( value->Get< int >() != static_cast< int >( DevelImageVisual::PlayState::PLAYING ) )
  163 + {
  164 + mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Pause" );
163 165
164 - DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PLAY, Property::Value() );  
165 - }  
166 - else  
167 - {  
168 - mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Play" ); 166 + DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PLAY, Property::Value() );
  167 + }
  168 + else
  169 + {
  170 + mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Play" );
169 171
170 - DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PAUSE, Property::Value() ); 172 + DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PAUSE, Property::Value() );
  173 + }
171 } 174 }
172 175
173 return true; 176 return true;