summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-25 21:20:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-01-25 21:22:43 +0000
commite11fe1886a58498899d7b074348186a46c5f6ac6 (patch)
tree525555401a5e305ed98ad17026631c975ef2429f /sc
parent475461a6b5f26fe7f586ff122e2fa71316e316ef (diff)
coverity#1266474 Dereference null return value
Change-Id: I240be73629a26a7067bfde5d2b662315a3259d1f
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/documen4.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 27f8a20d9267..ba09b3b92508 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -82,14 +82,19 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
GetCellType(nVCol, nVRow, nVTab, eVType);
// #i108005# convert target value to number using default format,
// as previously done in ScInterpreter::GetDouble
+ ScFormulaCell* pFormula = NULL;
double fTargetVal = 0.0;
sal_uInt32 nFIndex = 0;
if ( eFType == CELLTYPE_FORMULA && eVType == CELLTYPE_VALUE &&
GetFormatTable()->IsNumberFormat( sValStr, nFIndex, fTargetVal ) )
{
+ ScAddress aFormulaAdr( nFCol, nFRow, nFTab );
+ pFormula = GetFormulaCell( aFormulaAdr );
+ }
+ if (pFormula)
+ {
bool bDoneIteration = false;
ScAddress aValueAdr( nVCol, nVRow, nVTab );
- ScAddress aFormulaAdr( nFCol, nFRow, nFTab );
double* pVCell = GetValueCell( aValueAdr );
ScRange aVRange( aValueAdr, aValueAdr ); // for SetDirty
@@ -104,7 +109,6 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
double fBestF, fFPrev;
fBestX = fXPrev = fSaveVal;
- ScFormulaCell* pFormula = GetFormulaCell( aFormulaAdr );
pFormula->Interpret();
bool bError = ( pFormula->GetErrCode() != 0 );
// bError always corresponds with fF