diff options
author | Catalin Iacob <iacobcatalin@gmail.com> | 2012-02-23 12:57:22 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-02-23 12:59:14 +0000 |
commit | f881540b3295c17286f8003c7b897907bf9f57cb (patch) | |
tree | a9b5da15fc3b1aafa4fba700a91b523ec747fe70 /sc/source/filter | |
parent | 3b18642d62dad7128420f1d59f632acf5057da2b (diff) |
cppcheck: fix "possible null dereference" in ScMyCellInfo::CreateCell.
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index 55140b1052b2..435992951dfc 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; |