[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Thu Aug 13 00:34:46 PDT 2015


 sw/source/ui/vba/vbatablehelper.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 348cc2ce1e932f0fcaf90f9cf4d6dc9594f3f8a2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 13 08:33:37 2015 +0100

    wrong row/col count limits
    
    thanks to ccsheller for noticing
    
    Change-Id: Idb0f39c48173445b750e0b85ac20b3f6b43691a7

diff --git a/sw/source/ui/vba/vbatablehelper.cxx b/sw/source/ui/vba/vbatablehelper.cxx
index 755ecd8..65f02fd 100644
--- a/sw/source/ui/vba/vbatablehelper.cxx
+++ b/sw/source/ui/vba/vbatablehelper.cxx
@@ -61,7 +61,6 @@ sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno
 sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeException)
 {
     sal_Int32 nRet = 0;
-    //sal_Int32 nRowCount = mxTextTable->getRows()->getCount();
     sal_Int32 nRowCount = pTable->GetTabLines().size();
     for( sal_Int32 index = 0; index < nRowCount; index++ )
     {
@@ -141,15 +140,15 @@ SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw
 {
     SwTableLines& rLines = pTable->GetTabLines();
     sal_Int32 nRowCount = rLines.size();
-    if( nRowCount < nRow )
+    if (nRow >= nRowCount)
         throw uno::RuntimeException();
 
-    SwTableBox* pStart = NULL;
     SwTableLine* pLine = rLines[ nRow ];
-    if( (sal_Int32)pLine->GetTabBoxes().size() < nCol )
+    sal_Int32 nColCount = pLine->GetTabBoxes().size();
+    if (nCol >= nColCount)
         throw uno::RuntimeException();
 
-    pStart = pLine->GetTabBoxes()[ nCol ];
+    SwTableBox* pStart = pLine->GetTabBoxes()[ nCol ];
 
     if( !pStart )
         throw uno::RuntimeException();


More information about the Libreoffice-commits mailing list