sw/source/writerfilter/dmapper/PropertyMap.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+)
New commits: commit 61fd72bff241cf3cb0556cee7e414a698c46cd1d Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Dec 16 16:47:36 2024 -0500 Commit: Justin Luth <justin.l...@collabora.com> CommitDate: Tue Dec 17 02:33:41 2024 +0100 tdf#164263 writerfilter: avoid exception when SAL_DISABLE_PRINTERLIST This fixes a backported to 24.2.1 regression from commit e6f75eb50bc5d1ebccda0c0f80a7b353d991106e Apparently a blank value is allowed to be in RES_PAPER_BIN, but it is not allowed to try to setPropertyValue as a blank string. Lots of ways I could try to solve it. -could just lump it in with staticDenylist, but that is comment-labeled as "read only values". -could just wrap setPropertyValue in a try/catch, which is tempting because it is a generic fix for these otherwise silent failures, but that would hide potentially useful info behind a generic exception message. -just do the one-off check like I first decided to do. I don't see any unit test examples from the offending regression, or anything else in SW. So I don't know how I can create a unit test for this. Change-Id: Ic2506dd4adb71f0e64d719363f6d261ffccf0151 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178620 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx b/sw/source/writerfilter/dmapper/PropertyMap.cxx index ce373b092890..950c62d61029 100644 --- a/sw/source/writerfilter/dmapper/PropertyMap.cxx +++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx @@ -1507,6 +1507,16 @@ void SectionPropertyMap::CreateEvenOddPageStyleCopy(DomainMapper_Impl& rDM_Impl, else if (rProperty.Name == u"RightMargin"_ustr) sSetName = u"LeftMargin"_ustr; } + + if (rProperty.Name == u"PrinterPaperTray"_ustr + || rProperty.Name == u"PrinterPaperTrayIndex"_ustr) + { + const uno::Any aTray = pageProperties->getPropertyValue(rProperty.Name); + // exception if tray SET with an empty value (even though it may be empty) + if (aTray.has<OUString>() && aTray.get<OUString>().isEmpty()) + continue; + } + evenOddStyle->setPropertyValue( sSetName, pageProperties->getPropertyValue(rProperty.Name));