sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 33 +++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-)
New commits: commit f881540b3295c17286f8003c7b897907bf9f57cb Author: Catalin Iacob <iacobcata...@gmail.com> Date: Thu Feb 23 12:57:22 2012 +0000 cppcheck: fix "possible null dereference" in ScMyCellInfo::CreateCell. diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index 55140b1..4359929 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -63,26 +63,23 @@ ScMyCellInfo::~ScMyCellInfo() ScBaseCell* ScMyCellInfo::CreateCell(ScDocument* pDoc) { - if (pDoc) + if (!pCell && !sFormula.isEmpty() && !sFormulaAddress.isEmpty()) { - if (!pCell && !sFormula.isEmpty() && !sFormulaAddress.isEmpty()) - { - ScAddress aPos; - sal_Int32 nOffset(0); - ScRangeStringConverter::GetAddressFromString(aPos, sFormulaAddress, pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset); - pCell = new ScFormulaCell(pDoc, aPos, sFormula, eGrammar, nMatrixFlag); - static_cast<ScFormulaCell*>(pCell)->SetMatColsRows(static_cast<SCCOL>(nMatrixCols), static_cast<SCROW>(nMatrixRows)); - } + ScAddress aPos; + sal_Int32 nOffset(0); + ScRangeStringConverter::GetAddressFromString(aPos, sFormulaAddress, pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset); + pCell = new ScFormulaCell(pDoc, aPos, sFormula, eGrammar, nMatrixFlag); + static_cast<ScFormulaCell*>(pCell)->SetMatColsRows(static_cast<SCCOL>(nMatrixCols), static_cast<SCROW>(nMatrixRows)); + } - if ((nType == NUMBERFORMAT_DATE || nType == NUMBERFORMAT_TIME) && sInputString.Len() == 0) - { - sal_uInt32 nFormat(0); - if (nType == NUMBERFORMAT_DATE) - nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_DATE, ScGlobal::eLnge ); - else if (nType == NUMBERFORMAT_TIME) - nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_TIME, ScGlobal::eLnge ); - pDoc->GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString); - } + if ((nType == NUMBERFORMAT_DATE || nType == NUMBERFORMAT_TIME) && sInputString.Len() == 0) + { + sal_uInt32 nFormat(0); + if (nType == NUMBERFORMAT_DATE) + nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_DATE, ScGlobal::eLnge ); + else if (nType == NUMBERFORMAT_TIME) + nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_TIME, ScGlobal::eLnge ); + pDoc->GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString); } return pCell ? pCell->CloneWithoutNote( *pDoc ) : 0; _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits