From 720a51a3c0649be2b4dc464a7153b5162c47d2ea Mon Sep 17 00:00:00 2001 From: Lukasz Oleksak Date: Wed, 7 Oct 2020 13:18:19 +0200 Subject: [PATCH] [AT-SPI] Guard added for potential null pointer dereference Change-Id: Ib0fdcdf42d43f98e95d544fc27693b94282afb41 --- dali-toolkit/internal/controls/buttons/button-impl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index 1f5510d..b696a52 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -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( Toolkit::Button::Property::LABEL ); - Property::Map label = slf.GetProperty( 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; -- 2.7.4