(AnimatedVectorImages) Fixed SVACE error 89/198089/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 18 Jan 2019 14:09:32 +0000 (14:09 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 18 Jan 2019 14:14:11 +0000 (14:14 +0000)
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

index d7e4f8a..4e6656a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -157,17 +157,20 @@ private:
     Property::Map map = imageView.GetProperty< Property::Map >( ImageView::Property::IMAGE );
     Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE );
 
     Property::Map map = imageView.GetProperty< Property::Map >( ImageView::Property::IMAGE );
     Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE );
 
-    if( value->Get< int >() != static_cast< int >( DevelImageVisual::PlayState::PLAYING ) )
+    if( value )
     {
     {
-      mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Pause" );
+      if( value->Get< int >() != static_cast< int >( DevelImageVisual::PlayState::PLAYING ) )
+      {
+        mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Pause" );
 
 
-      DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PLAY, Property::Value() );
-    }
-    else
-    {
-      mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Play" );
+        DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PLAY, Property::Value() );
+      }
+      else
+      {
+        mPlayButtons[controlIndex].SetProperty( Button::Property::LABEL, "Play" );
 
 
-      DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PAUSE, Property::Value() );
+        DevelControl::DoAction( imageView, ImageView::Property::IMAGE, DevelAnimatedVectorImageVisual::Action::PAUSE, Property::Value() );
+      }
     }
 
     return true;
     }
 
     return true;