cid#1597280 Dereference null return value

Change-Id: I0275c178a478b7143b0cf4ed19f030009b7bd2fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167504
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-05-11 10:12:20 +01:00
parent fbfeb33b38
commit cc3a8a025b

View file

@ -916,12 +916,11 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, rtl::Reference<XFTable>
//register style for heading row
double fHeight = 0;
OUString styleName;
std::unique_ptr<XFRowStyle> xRowStyle(new XFRowStyle);
XFRow* pRow = pTmpTable->GetRow(1);
if (!pRow)
throw std::runtime_error("missing row");
styleName = pRow->GetStyleName();
OUString styleName = pRow->GetStyleName();
// get settings of the row and assign them to new row style
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
@ -932,7 +931,8 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, rtl::Reference<XFTable>
for (i=1;i<=nRowNum;i++)
{
styleName = pTmpTable->GetRow(i)->GetStyleName();
fHeight+=static_cast<XFRowStyle*>(pXFStyleManager->FindStyle(styleName))->GetRowHeight();
if (XFRowStyle* pRowStyle = static_cast<XFRowStyle*>(pXFStyleManager->FindStyle(styleName)))
fHeight+=pRowStyle->GetRowHeight();
}
if (m_nDirection & 0x0030)
{