Kaydet (Commit) e11fe188 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1266474 Dereference null return value

Change-Id: I240be73629a26a7067bfde5d2b662315a3259d1f
üst 475461a6
...@@ -82,14 +82,19 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, ...@@ -82,14 +82,19 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
GetCellType(nVCol, nVRow, nVTab, eVType); GetCellType(nVCol, nVRow, nVTab, eVType);
// #i108005# convert target value to number using default format, // #i108005# convert target value to number using default format,
// as previously done in ScInterpreter::GetDouble // as previously done in ScInterpreter::GetDouble
ScFormulaCell* pFormula = NULL;
double fTargetVal = 0.0; double fTargetVal = 0.0;
sal_uInt32 nFIndex = 0; sal_uInt32 nFIndex = 0;
if ( eFType == CELLTYPE_FORMULA && eVType == CELLTYPE_VALUE && if ( eFType == CELLTYPE_FORMULA && eVType == CELLTYPE_VALUE &&
GetFormatTable()->IsNumberFormat( sValStr, nFIndex, fTargetVal ) ) GetFormatTable()->IsNumberFormat( sValStr, nFIndex, fTargetVal ) )
{
ScAddress aFormulaAdr( nFCol, nFRow, nFTab );
pFormula = GetFormulaCell( aFormulaAdr );
}
if (pFormula)
{ {
bool bDoneIteration = false; bool bDoneIteration = false;
ScAddress aValueAdr( nVCol, nVRow, nVTab ); ScAddress aValueAdr( nVCol, nVRow, nVTab );
ScAddress aFormulaAdr( nFCol, nFRow, nFTab );
double* pVCell = GetValueCell( aValueAdr ); double* pVCell = GetValueCell( aValueAdr );
ScRange aVRange( aValueAdr, aValueAdr ); // for SetDirty ScRange aVRange( aValueAdr, aValueAdr ); // for SetDirty
...@@ -104,7 +109,6 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, ...@@ -104,7 +109,6 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
double fBestF, fFPrev; double fBestF, fFPrev;
fBestX = fXPrev = fSaveVal; fBestX = fXPrev = fSaveVal;
ScFormulaCell* pFormula = GetFormulaCell( aFormulaAdr );
pFormula->Interpret(); pFormula->Interpret();
bool bError = ( pFormula->GetErrCode() != 0 ); bool bError = ( pFormula->GetErrCode() != 0 );
// bError always corresponds with fF // bError always corresponds with fF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment