sw/source/core/unocore/unostyle.cxx | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit fcfc754b8f8aaa6bc6d3f22c007b3d8a94d53d9f Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Dec 16 16:47:36 2024 -0500 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Jan 7 12:26:37 2025 +0100 tdf#164263: avoid exception when SAL_DISABLE_PRINTERLIST #2 This fixes a backported to 24.2.1 regression from commit e6f75eb50bc5d1ebccda0c0f80a7b353d991106e Although an empty OUString is returned when IsDisplayPrinter(), using that to setPropertyValue causes an exception. Since IsDisplayPrinter always returns static values for all queries, there is no need to actually attempt to make any changes when IsDisplayPrinter(). I don't see any unit test examples from the offending regression, or anything else in SW relating to Printer or environment variables, nor is there any explict call available to set mpDisplayDev, so I don't know how I can create a unit test for this. Change-Id: I3d4054df57ab460833d9994d71133aef64cbb714 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178753 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178827 (cherry picked from commit 1dc4846e76570ab19c028ac23786e4ffd8fc4679) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178843 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index b163817d3aca..a796f88078f7 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1574,6 +1574,11 @@ 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); + + // PAPER_BINs have no meaning when there is no actual printer + if (pPrinter->IsDisplayPrinter()) + return; + using printeridx_t = decltype(pPrinter->GetPaperBinCount()); printeridx_t nBin = std::numeric_limits<printeridx_t>::max(); if(rValue.has<OUString>())