It's safe to remove the check since CreateCell is only called by
CreateContentAction, CreateGeneratedActions and SetDependencies in the
same file and those in turn are only called by CreateChangeTrack only
if pDoc is not NULL.
---
.../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 7a9b81e..562a5a4 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -77,26 +77,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;
Context
- [PATCH] Fix cppcheck "possible null dereference" in ScMyCellInfo::CreateCell. · Catalin Iacob
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.