sw/source/core/access/accmap.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 37e04716bbe68c7d9707dd69dbc90c296cd63978
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Apr 17 11:27:52 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 18 08:29:44 2025 +0200

    sw a11y: Reduce variable scope + move check into if body
    
    Change-Id: I10f0019eeedb396198078c380153323b54d5ab40
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184331
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index d56fa98645ad..46297f83d3e1 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2722,21 +2722,18 @@ sal_Int32 SwAccessibleMap::GetChildIndex( const 
SwFrame& rParentFrame,
     SwAccessibleChild aFrameOrObj( &rParentFrame );
     if (aFrameOrObj.IsAccessible(GetShell().IsPreview()))
     {
-        rtl::Reference < SwAccessibleContext > xAcc;
-
         if( mpFrameMap )
         {
             SwAccessibleContextMap_Impl::iterator aIter =
                                     mpFrameMap->find( aFrameOrObj.GetSwFrame() 
);
             if( aIter != mpFrameMap->end() )
             {
-                xAcc = (*aIter).second;
+                rtl::Reference<SwAccessibleContext> xAcc = (*aIter).second;
+                if (xAcc.is())
+                    nIndex = 
xAcc->GetChildIndex(const_cast<SwAccessibleMap&>(*this),
+                                                 SwAccessibleChild(&rChild));
             }
         }
-
-        if( xAcc.is() )
-            nIndex = xAcc->GetChildIndex( const_cast<SwAccessibleMap&>(*this),
-                                              SwAccessibleChild( &rChild ) );
     }
 
     return nIndex;

Reply via email to