diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 7d87177cddfe..ec938d88aeb4 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -637,23 +637,26 @@ public: ScFormulaCell* pTop = *rEntry.mpCells; OUString aFormula = pTop->GetHybridFormula(); - // Create a new token array from the hybrid formula string, and - // set it to the group. - ScCompiler aComp(mrCompileFormulaCxt, pTop->aPos); - ScTokenArray* pNewCode = aComp.CompileString(aFormula); - ScFormulaCellGroupRef xGroup = pTop->GetCellGroup(); - assert(xGroup); - xGroup->setCode(pNewCode); - xGroup->compileCode(*mpDoc, pTop->aPos, mpDoc->GetGrammar()); - - // Propagate the new token array to all formula cells in the group. - ScFormulaCell** pp = rEntry.mpCells; - ScFormulaCell** ppEnd = pp + rEntry.mnLength; - for (; pp != ppEnd; ++pp) + if (!aFormula.isEmpty()) { - ScFormulaCell* p = *pp; - p->SyncSharedCode(); - p->SetDirty(); + // Create a new token array from the hybrid formula string, and + // set it to the group. + ScCompiler aComp(mrCompileFormulaCxt, pTop->aPos); + ScTokenArray* pNewCode = aComp.CompileString(aFormula); + ScFormulaCellGroupRef xGroup = pTop->GetCellGroup(); + assert(xGroup); + xGroup->setCode(pNewCode); + xGroup->compileCode(*mpDoc, pTop->aPos, mpDoc->GetGrammar()); + + // Propagate the new token array to all formula cells in the group. + ScFormulaCell** pp = rEntry.mpCells; + ScFormulaCell** ppEnd = pp + rEntry.mnLength; + for (; pp != ppEnd; ++pp) + { + ScFormulaCell* p = *pp; + p->SyncSharedCode(); + p->SetDirty(); + } } } else