[Libreoffice-commits] core.git: Branch 'libreoffice-4-3-7' - sc/source

Caolán McNamara caolanm at redhat.com
Mon Apr 20 08:53:11 PDT 2015


 sc/source/filter/excel/xestyle.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit d9ca5cc82281b27819ddbaf5e89e05a133adc741
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 15 10:04:05 2015 +0100

    fix crash on export of fdo68639-2.ods to xls with invalid mnLastIdx
    
    mnLastIdx doesn't get reset when the color list is reset, the code already
    acknowledges that mnLastIdx is the last set index but that it may not be a
    valid position, so only set rnIndex if mnLastIdx is valid and the data at that
    pos is the desired data.
    
    Change-Id: I57ce32fd1a13bfe9049ed94be34229c8c2808b8e
    (cherry picked from commit 6c3b1361a97f5219f90bf2f09f3c3f2b70b8e30e)
    Reviewed-on: https://gerrit.libreoffice.org/15319
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit e3c0596857ed8713de829ac9875892312f595504)
    Reviewed-on: https://gerrit.libreoffice.org/15443
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index f4c7640..9635acf 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -509,18 +509,22 @@ const Color& XclExpPaletteImpl::GetOriginalColor( sal_uInt32 nColorId ) const
 
 XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt32& rnIndex )
 {
-    rnIndex = mnLastIdx;
-    XclListColor* pEntry = NULL;
+    rnIndex = 0;
 
     if (mxColorList->empty())
         return NULL;
 
+    XclListColor* pEntry = NULL;
+
     // search optimization for equal-colored objects occurring repeatedly
-    if (rnIndex < mxColorList->size())
+    if (mnLastIdx < mxColorList->size())
     {
-        pEntry = &(*mxColorList)[rnIndex];
+        pEntry = &(*mxColorList)[mnLastIdx];
         if( pEntry->GetColor() == rColor )
+        {
+            rnIndex = mnLastIdx;
             return pEntry;
+        }
     }
 
     // binary search for color


More information about the Libreoffice-commits mailing list