diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-09-12 23:25:12 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-09-13 03:10:06 +0200 |
commit | 10863c2ef3f140844abe4e58f83a421086ac664b (patch) | |
tree | cba6a4b4d1da5786f601a6b61b746bb91994abb2 /sw/source | |
parent | 7c01cd840be90a42a747b17fa23174dc67654583 (diff) |
indexing: prevent crash when creting the indexing XML
The pOutlinerParagraphObject can be null, so need to check for
that or the applciation can crash.
Change-Id: Icf771bb9ae2c344ed04e8ec27a22390a272ad725
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121998
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 2f755ae4bf69951c29ec64c5df500687051e4ee3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122017
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/indexing/IndexingExport.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sw/source/filter/indexing/IndexingExport.cxx b/sw/source/filter/indexing/IndexingExport.cxx index 6c436f9f6180..6974fe599e58 100644 --- a/sw/source/filter/indexing/IndexingExport.cxx +++ b/sw/source/filter/indexing/IndexingExport.cxx @@ -123,17 +123,20 @@ public: if (pTextObject) { OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject(); - const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject(); - for (sal_Int32 nParagraph = 0; nParagraph < aEdit.GetParagraphCount(); ++nParagraph) + if (pOutlinerParagraphObject) { - OUString sText = aEdit.GetText(nParagraph); - - m_rXmlWriter.startElement("paragraph"); - m_rXmlWriter.attribute("index", nParagraph); - m_rXmlWriter.attribute("node_type", OString("common")); - m_rXmlWriter.attribute("object_name", pObject->GetName()); - m_rXmlWriter.content(sText); - m_rXmlWriter.endElement(); + const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject(); + for (sal_Int32 nParagraph = 0; nParagraph < aEdit.GetParagraphCount(); ++nParagraph) + { + OUString sText = aEdit.GetText(nParagraph); + + m_rXmlWriter.startElement("paragraph"); + m_rXmlWriter.attribute("index", nParagraph); + m_rXmlWriter.attribute("node_type", OString("common")); + m_rXmlWriter.attribute("object_name", pObject->GetName()); + m_rXmlWriter.content(sText); + m_rXmlWriter.endElement(); + } } } } |