sc/source/filter/xml/xmlexprt.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
New commits: commit 2221db381160726a2cf4a86c6c1a542619ce58be Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Nov 19 12:51:52 2024 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Nov 19 15:46:59 2024 +0100 catch invalid ranges at export log failure and continue to export the remainder of the document #0 0x0000733dda8ae4a1 in __cxa_throw () from target:/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x0000733dc5d0bd43 in ScCellRangeObj::getCellRangeByPosition (this=0x2a753d60, nLeft=43, nTop=-7, nRight=43, nBottom=-7) at sc/source/ui/unoobj/cellsuno.cxx:4638 #2 0x0000733dc66150d5 in ScTableSheetObj::getCellRangeByPosition (this=0x2a753d60, nLeft=43, nTop=-7, nRight=43, nBottom=-7) at sc/source/ui/unoobj/cellsuno.cxx:6711 #3 0x0000733dc62d3e38 in ScXMLExport::GetMerged (this=0x1fc74160, pCellAddress=<optimized out>, xTable=...) at sc/source/filter/xml/xmlexprt.cxx:2750 #4 0x0000733dc62d7104 in ScXMLExport::AddStyleFromCells (this=0x1fc74160, xProperties=..., xTable=..., nTable=0, pOldName=0x0) at sc/source/filter/xml/xmlexprt.cxx:2156 #5 0x0000733dc62dfebb in ScXMLExport::collectAutoStyles (this=<optimized out>) at sc/source/filter/xml/xmlexprt.cxx:2559 #6 0x0000733dc62d0fff in ScXMLExport::ExportAutoStyles_ (this=0x1fc74160) at sc/source/filter/xml/xmlexprt.cxx:2657 #7 0x0000733dd833a7a4 in SvXMLExport::ImplExportAutoStyles (this=0x1fc74160) at xmloff/source/core/xmlexp.cxx:1123 #8 0x0000733dd833d098 in SvXMLExport::exportDoc (this=0x1fc74160, eClass=<optimized out>) at xmloff/source/core/xmlexp.cxx:1389 #9 0x0000733dd83386f6 in SvXMLExport::filter (this=this@entry=0x1fc74160, aDescriptor=...) at xmloff/source/core/xmlexp.cxx:815 #10 0x0000733dc62e6452 in ScXMLExport::filter (this=0x1fc74160, aDescriptor=...) at sc/source/filter/xml/xmlexprt.cxx:5472 #11 0x0000733dc63204a0 in ScXMLImportWrapper::ExportToComponent (this=0x7ffc11959890, xContext=..., xModel=..., xWriter=..., aDescriptor=..., sName=..., sMediaType=..., sComponentName=..., aArgs=..., pSharedData=...) at sc/source/filter/xml/xmlwrap.cxx:707 #12 0x0000733dc632679a in ScXMLImportWrapper::Export (this=this@entry=0x7ffc11959890, bStylesOnly=bStylesOnly@entry=false) at sc/source/filter/xml/xmlwrap.cxx:943 #13 0x0000733dc6465d5e in ScDocShell::SaveXML (this=0x11d1c440, pSaveMedium=0x138252f0, xStor=...) at sc/source/ui/docshell/docsh.cxx:653 #14 0x0000733dc646a519 in ScDocShell::SaveAs (this=0x11d1c440, rMedium=...) at sc/source/ui/docshell/docsh.cxx:1913 #15 0x0000733dd6ae7432 in SfxObjectShell::SaveAsOwnFormat (this=0x11d1c440, rMedium=...) at sfx2/source/doc/objstor.cxx:3378 #16 0x0000733dd6af0ae6 in SfxObjectShell::SaveTo_Impl (this=0x11d1c440, rMedium=..., pSet=0x7ffc11959fe0) at sfx2/source/doc/objstor.cxx:1520 #17 0x0000733dd6af2f08 in SfxObjectShell::DoSave_Impl (this=0x11d1c440, pArgs=0x7ffc11959fe0) at sfx2/source/doc/objstor.cxx:2760 #18 0x0000733dd6b2b3aa in SfxBaseModel::storeSelf (this=0x5348c30, aSeqArgs=...) at /opt/rh/devtoolset-12/root/usr/include/c++/12/optional:306 #19 0x0000733dd6ab2671 in SfxStoringHelper::GUIStoreModel (this=this@entry=0x2ba275b0, xModel=..., aSlotName=..., aArgsSequence=..., bPreselectPassword=bPreselectPassword@entry=false, nDocumentSignatureState=SignatureState::NOSIGNATURES, bIsAsync=false) perhaps some relation to https://gerrit.libreoffice.org/c/core/+/160363 which is a somewhat similar situation Change-Id: I6b28ef0e9df0f44641fa5c582b5827dbcfb4af8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176765 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 74c9d093d546..66a147e13ea4 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2736,6 +2736,19 @@ void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > const } } +static uno::Reference<sheet::XSheetCellRange> lclGetSheetRange(const uno::Reference <sheet::XSpreadsheet>& xTable, sal_Int32 nCol, sal_Int32 nRow) +{ + try + { + return uno::Reference<sheet::XSheetCellRange>(xTable->getCellRangeByPosition(nCol, nRow, nCol, nRow), uno::UNO_QUERY); + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("sc", "Exception in getCellRangeByPosition, col: " << nCol << ", row: " << nRow); + } + return nullptr; +} + bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress, const uno::Reference <sheet::XSpreadsheet>& xTable) { @@ -2747,7 +2760,7 @@ bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress, bool bRowInc(nEndRow > nRow); while(!bReady && nRow <= nEndRow && nCol <= nEndCol) { - uno::Reference<sheet::XSheetCellRange> xSheetCellRange(xTable->getCellRangeByPosition(nCol, nRow, nCol, nRow), uno::UNO_QUERY); + uno::Reference<sheet::XSheetCellRange> xSheetCellRange(lclGetSheetRange(xTable, nCol, nRow)); if (xSheetCellRange.is()) { uno::Reference<sheet::XSheetCellCursor> xCursor(xTable->createCursorByRange(xSheetCellRange));