sw/source/core/unocore/unostyle.cxx | 6 ++++-- sw/source/ui/index/swuiidxmrk.cxx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
New commits: commit 7aa24c8064c7f6562a1a98f087b468bdc379133a Author: Caolán McNamara <[email protected]> AuthorDate: Sun Dec 22 12:28:52 2024 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Dec 22 15:27:59 2024 +0100 cid#1529286 silence Explicit null dereferenced Change-Id: I03909c8ed7e9f2bf410412b02790aee0fbca6d58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179138 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 71c6622032a4..3b3584569e73 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -1752,6 +1752,7 @@ void SwCreateAuthEntryDlg_Impl::SetFields(const OUString pFields[], bool bNewEnt } break; case AUTH_FIELD_TARGET_TYPE: + assert(m_xTargetTypeListBox && "No TargetType ListBox"); if (!pFields[aCurInfo.nToxField].isEmpty()) { m_xTargetTypeListBox->set_active(pFields[aCurInfo.nToxField].toInt32()); commit 40516b3ef9f430204d25e8a7d91ab5ca63475181 Author: Caolán McNamara <[email protected]> AuthorDate: Sun Dec 22 12:19:07 2024 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Dec 22 15:27:46 2024 +0100 cid#1636858 Dereference before null check Change-Id: I03aa87d1a265761ac2f781e33b6136a4c38cbb31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179137 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 96d3056f83af..1209470951bb 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1671,7 +1671,9 @@ void SwXStyle::SetPropertyValue<sal_uInt16(RES_PAPER_BIN)>(const SfxItemProperty { if (!rValue.has<OUString>() && !rValue.has<sal_Int32>()) throw lang::IllegalArgumentException(); + SfxPrinter* pPrinter = m_pDoc->getIDocumentDeviceAccess().getPrinter(true); + assert(pPrinter && "getPrinter(true) always returns a non-null SfxPrinter"); // PAPER_BINs have no meaning when there is no actual printer if (pPrinter->IsDisplayPrinter()) @@ -1684,7 +1686,7 @@ void SwXStyle::SetPropertyValue<sal_uInt16(RES_PAPER_BIN)>(const SfxItemProperty OUString sValue(rValue.get<OUString>()); if(sValue == "[From printer settings]") nBin = std::numeric_limits<printeridx_t>::max()-1; - else if(pPrinter) + else { for(printeridx_t i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; ++i) { @@ -1696,7 +1698,7 @@ void SwXStyle::SetPropertyValue<sal_uInt16(RES_PAPER_BIN)>(const SfxItemProperty } } } - else if (rValue.has<sal_Int32>() && pPrinter) + else if (rValue.has<sal_Int32>()) { sal_Int32 nValue (rValue.get<sal_Int32>()); nBin = pPrinter->GetPaperBinBySourceIndex(nValue);
