[AT-SPI] Guard added for potential null pointer dereference
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / button-impl.cpp
index 1f5510d..b696a52 100644 (file)
@@ -1316,16 +1316,20 @@ Padding Button::GetForegroundPadding()
 
 std::string Button::AccessibleImpl::GetNameRaw()
 {
+  std::string labelText;
   auto slf = Toolkit::Button::DownCast( self );
+  Property::Map labelMap = slf.GetProperty<Property::Map>( Toolkit::Button::Property::LABEL );
 
-  Property::Map label = slf.GetProperty<Property::Map>( Toolkit::Button::Property::LABEL );
-
-  std::string labelText;
-  label.Find( Toolkit::TextVisual::Property::TEXT )->Get( labelText );
+  Property::Value* textPropertyPtr = labelMap.Find( Toolkit::TextVisual::Property::TEXT );
+  if ( textPropertyPtr )
+  {
+    textPropertyPtr->Get( labelText );
+  }
 
   return labelText;
 }
 
+
 Property::Index Button::AccessibleImpl::GetNamePropertyIndex()
 {
   Property::Index label = Toolkit::Button::Property::LABEL;