diff options
author | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-09-30 13:09:13 +0200 |
---|---|---|
committer | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-10-01 21:25:02 +0200 |
commit | a8356ceb0f9345ebd5171439e3b882642f5fbad5 (patch) | |
tree | 811ef64b4acc458ddc3bae933d189d01c1af044f /oox/source/drawingml | |
parent | 41ffa6179905a54acd144f8202a44edac35cc9b4 (diff) |
SmartArt edit UI: fix crash on empty node text
Change-Id: Idacbbb50cbdd8ae4c78f3159bc362c7ee2137149
Reviewed-on: https://gerrit.libreoffice.org/79848
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/diagram/datamodel.cxx | 9 | ||||
-rw-r--r-- | oox/source/drawingml/textbody.cxx | 8 |
2 files changed, 12 insertions, 5 deletions
diff --git a/oox/source/drawingml/diagram/datamodel.cxx b/oox/source/drawingml/diagram/datamodel.cxx index bfbd67537171..fcad85bd3d6a 100644 --- a/oox/source/drawingml/diagram/datamodel.cxx +++ b/oox/source/drawingml/diagram/datamodel.cxx @@ -96,7 +96,7 @@ void DiagramData::getChildrenString(OUStringBuffer& rBuf, const dgm::Point* pPoi rBuf.append('\t'); rBuf.append('+'); rBuf.append(' '); - rBuf.append(pPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText()); + rBuf.append(pPoint->mpShape->getTextBody()->toString()); rBuf.append('\n'); } @@ -136,7 +136,7 @@ std::vector<std::pair<OUString, OUString>> DiagramData::getChildren(const OUStri if (pChild != maPointNameMap.end()) aChildren[rCxn.mnSourceOrder] = std::make_pair( pChild->second->msModelId, - pChild->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText()); + pChild->second->mpShape->getTextBody()->toString()); } // HACK: empty items shouldn't appear there @@ -361,8 +361,7 @@ void DiagramData::build() // does currpoint have any text set? if( point.mpShape && point.mpShape->getTextBody() && - !point.mpShape->getTextBody()->getParagraphs().empty() && - !point.mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() ) + !point.mpShape->getTextBody()->isEmpty() ) { #ifdef DEBUG_OOX_DIAGRAM static sal_Int32 nCount=0; @@ -371,7 +370,7 @@ void DiagramData::build() << " [" << "label=\"" << OUStringToOString( - point.mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText(), + point.mpShape->getTextBody()->toString(), RTL_TEXTENCODING_UTF8).getStr() << "\"" << "];" << std::endl; output << "\t" diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx index 55989a470a3f..80ebb4d2287d 100644 --- a/oox/source/drawingml/textbody.cxx +++ b/oox/source/drawingml/textbody.cxx @@ -96,6 +96,14 @@ bool TextBody::isEmpty() const return aRuns[0]->getText().getLength() <= 0; } +OUString TextBody::toString() const +{ + if (!isEmpty()) + return maParagraphs.front()->getRuns().front()->getText(); + else + return OUString(); +} + void TextBody::ApplyStyleEmpty( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < XText > & xText, |