DetachFormulaCellsHandler never passed a null ScDocument*

Change-Id: I7974fbfe832bbb20a1aab868826611a0f7a05698
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102664
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2020-09-14 10:59:43 +01:00
parent 90fbbecb2e
commit e24430486f

View file

@ -380,19 +380,19 @@ public:
class DetachFormulaCellsHandler
{
ScDocument* mpDoc;
ScDocument& mrDoc;
sc::EndListeningContext* mpCxt;
public:
DetachFormulaCellsHandler( ScDocument* pDoc, sc::EndListeningContext* pCxt ) :
mpDoc(pDoc), mpCxt(pCxt) {}
DetachFormulaCellsHandler( ScDocument& rDoc, sc::EndListeningContext* pCxt ) :
mrDoc(rDoc), mpCxt(pCxt) {}
void operator() (size_t /*nRow*/, ScFormulaCell* pCell)
{
if (mpCxt)
pCell->EndListeningTo(*mpCxt);
else
pCell->EndListeningTo(*mpDoc);
pCell->EndListeningTo(mrDoc);
}
};
@ -459,7 +459,7 @@ void ScColumn::DetachFormulaCells(
if (GetDoc()->IsClipOrUndo())
return;
DetachFormulaCellsHandler aFunc(GetDoc(), nullptr);
DetachFormulaCellsHandler aFunc(*GetDoc(), nullptr);
sc::ProcessFormula(aPos.first, maCells, nRow, nNextTopRow-1, aFunc);
}
@ -542,7 +542,7 @@ void ScColumn::DetachFormulaCells( sc::EndListeningContext& rCxt, SCROW nRow1, S
if (GetDoc()->IsClipOrUndo())
return;
DetachFormulaCellsHandler aFunc(GetDoc(), &rCxt);
DetachFormulaCellsHandler aFunc(*GetDoc(), &rCxt);
sc::ProcessFormula(it, maCells, nRow1, nRow2, aFunc);
}