From cc3a8a025b816fd94e98070d84140c392f142f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 11 May 2024 10:12:20 +0100 Subject: [PATCH] cid#1597280 Dereference null return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0275c178a478b7143b0cf4ed19f030009b7bd2fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167504 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- lotuswordpro/source/filter/lwptablelayout.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index 9c1ceea67f5b..90fb18c7ba67 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -916,12 +916,11 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, rtl::Reference //register style for heading row double fHeight = 0; - OUString styleName; std::unique_ptr 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 for (i=1;i<=nRowNum;i++) { styleName = pTmpTable->GetRow(i)->GetStyleName(); - fHeight+=static_cast(pXFStyleManager->FindStyle(styleName))->GetRowHeight(); + if (XFRowStyle* pRowStyle = static_cast(pXFStyleManager->FindStyle(styleName))) + fHeight+=pRowStyle->GetRowHeight(); } if (m_nDirection & 0x0030) {