sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |   24 +++++++------------
 1 file changed, 10 insertions(+), 14 deletions(-)

New commits:
commit c0a9c3f97d7da054f40572667847274b725372d8
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Oct 18 00:48:58 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Oct 18 09:22:04 2024 +0200

    tdf#163486: PVS: redundant nullptr check
    
    V668    There is no sense in testing the 'mpMarkedRanges' pointer against 
null, as the memory was allocated using the 'new' operator. The exception will 
be generated in the case of memory allocation error.
    V668    There is no sense in testing the 'mpMarkedRanges' pointer against 
null, as the memory was allocated using the 'new' operator. The exception will 
be generated in the case of memory allocation error.
    
    Change-Id: Iba55f15534cdc9af5b86b288b5c42702ad83dc26
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175107
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 6b7162718225..9023902a4106 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -1205,8 +1205,7 @@ sal_Int64 SAL_CALL
                 aMarkData.FillRangeListWithMarks(mpMarkedRanges.get(), false);
             }
             // is possible, because there shouldn't be overlapped ranges in it
-            if (mpMarkedRanges)
-                nResult = mpMarkedRanges->GetCellCount();
+            nResult = mpMarkedRanges->GetCellCount();
         }
     }
     return nResult;
@@ -1234,20 +1233,17 @@ uno::Reference<XAccessible > SAL_CALL
             mpMarkedRanges.reset(new ScRangeList());
             
mpViewShell->GetViewData().GetMarkData().FillRangeListWithMarks(mpMarkedRanges.get(),
 false);
         }
-        if (mpMarkedRanges)
+        if ((nSelectedChildIndex < 0) ||
+                (mpMarkedRanges->GetCellCount() <= 
o3tl::make_unsigned(nSelectedChildIndex)))
         {
-            if ((nSelectedChildIndex < 0) ||
-                    (mpMarkedRanges->GetCellCount() <= 
o3tl::make_unsigned(nSelectedChildIndex)))
-            {
-                throw lang::IndexOutOfBoundsException();
-            }
-            ScMyAddress addr = 
CalcScAddressFromRangeList(mpMarkedRanges.get(),nSelectedChildIndex);
-            auto it = m_mapSelectionSend.find(addr);
-            if( it != m_mapSelectionSend.end() )
-                xAccessible = it->second;
-            else
-                xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
+            throw lang::IndexOutOfBoundsException();
         }
+        ScMyAddress addr = 
CalcScAddressFromRangeList(mpMarkedRanges.get(),nSelectedChildIndex);
+        auto it = m_mapSelectionSend.find(addr);
+        if( it != m_mapSelectionSend.end() )
+            xAccessible = it->second;
+        else
+            xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
     }
     return xAccessible;
 }

Reply via email to