[AT-SPI] Guard added for potential null pointer dereference 48/245348/9
authorLukasz Oleksak <l.oleksak@samsung.com>
Wed, 7 Oct 2020 11:18:19 +0000 (13:18 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 23 Oct 2020 13:07:01 +0000 (15:07 +0200)
Change-Id: Ib0fdcdf42d43f98e95d544fc27693b94282afb41

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;