[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Sep 29 11:19:00 PDT 2012


 sc/source/filter/oox/sheetdatacontext.cxx |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 010e207039cc12bf7c688d978adeb16c0802333e
Author: Katarina Behrens <bubli at bubli.org>
Date:   Sat Sep 29 20:09:42 2012 +0200

    fdo #50343: Fixed crash on xlsx import of file with array formula
    
    Follow-up of 7fff98724bc7e3. Buffer only cell formula values via
    setCellFormulaValue. Otherwise we get crash in
    FormulaBuffer::applyCellFormulaValues() as array/shared/datatable
    formulas are treated differently
    
    Change-Id: Ie344b273ec662e8af1bf9fa54e79614393634974

diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index 7ca86d7..c7db69c 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -184,7 +184,13 @@ void SheetDataContext::onEndElement()
             case XML_normal:
                 setCellFormula( maCellData.maCellAddr, maFormulaStr );
                 mrSheetData.setCellFormat( maCellData );
+
+                // If a number cell has some preloaded value, stick it into the buffer
+                // but do this only for real cell formulas (not array, shared etc.)
+                if( !( maCellValue.isEmpty() ) && ( maCellData.mnCellType == XML_n ) )
+                    setCellFormulaValue( maCellData.maCellAddr, maCellValue.toDouble() );
                 break;
+
             case XML_shared:
                 if( maFmlaData.mnSharedId >= 0 )
                 {
@@ -249,13 +255,6 @@ void SheetDataContext::onEndElement()
                 mrSheetData.setBlankCell( maCellData );
             }
         }
-        else if( !maCellValue.isEmpty() ) switch( maCellData.mnCellType )
-        {
-            case XML_n:
-                /* Set the pre-loaded value */
-                setCellFormulaValue( maCellData.maCellAddr, maCellValue.toDouble() );
-                break;
-        }
     }
 }
 


More information about the Libreoffice-commits mailing list