[AT-SPI] Fixed unreachable condition and counting of selected children 55/245355/10
authorMaria Bialota <m.bialota@samsung.com>
Wed, 7 Oct 2020 12:28:24 +0000 (14:28 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 23 Oct 2020 13:01:46 +0000 (15:01 +0200)
Change-Id: I6fa871a438b7ecf7bc07151209bd3aa1d1f4142b

dali/internal/accessibility/bridge/bridge-accessible.cpp

index 8168c0c..03a6677 100644 (file)
@@ -287,7 +287,7 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
   auto indexInParent = static_cast< int32_t >( self->GetIndexInParent() );
   bool isSelectedInParent = false;
   bool hasCheckBoxChild = false;
-  int32_t firstSelectedChildIndex = 0;
+  int32_t firstSelectedChildIndex = -1;
   int32_t selectedChildCount = 0;
 
   for( auto i = 0u; i < static_cast< size_t >( childCount ); ++i )
@@ -296,9 +296,9 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
     auto s = q->GetStates();
     if( s[State::SELECTABLE] )
     {
-      ++selectedChildCount;
       if( s[State::SELECTED] )
       {
+        ++selectedChildCount;
         if( firstSelectedChildIndex < 0 )
           firstSelectedChildIndex = static_cast< int32_t >( i );
       }