cid#1448220 Explicit null dereferenced

Change-Id: I0e612cf738d54e2108458da5c4afe78f1699f475
Reviewed-on: https://gerrit.libreoffice.org/76105
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2019-07-22 11:11:39 +01:00
parent 759cda89d8
commit ff7015fd35

View File

@@ -408,26 +408,26 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
}
case WID_CONDFRMT_REF:
{
bool bFound = false;
const ScCondFormatDlgItem* pDlgItem = nullptr;
// Get the pool item stored by Conditional Format Manager Dialog.
const SfxPoolItem* pItem = nullptr;
auto itemsRange = GetPool().GetItemSurrogates(SCITEM_CONDFORMATDLGDATA);
if (itemsRange.begin() != itemsRange.end())
{
pItem = *itemsRange.begin();
const SfxPoolItem* pItem = *itemsRange.begin();
pDlgItem = static_cast<const ScCondFormatDlgItem*>(pItem);
bFound = true;
}
ScViewData& rViewData = GetViewData();
rViewData.SetRefTabNo( rViewData.GetTabNo() );
if (pDlgItem)
{
ScViewData& rViewData = GetViewData();
rViewData.SetRefTabNo( rViewData.GetTabNo() );
xResult.reset(new ScCondFormatDlg(pB, pCW, pParent, &rViewData, pDlgItem));
xResult.reset(new ScCondFormatDlg(pB, pCW, pParent, &rViewData, pDlgItem));
// Remove the pool item stored by Conditional Format Manager Dialog.
GetPool().Remove(*pDlgItem);
}
// Remove the pool item stored by Conditional Format Manager Dialog.
if ( bFound && pItem )
GetPool().Remove( *pItem );
break;
}
}