oox/inc/drawingml/textbody.hxx             |    1 +
 oox/source/drawingml/diagram/datamodel.cxx |    9 ++++-----
 oox/source/drawingml/textbody.cxx          |    8 ++++++++
 3 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit a8356ceb0f9345ebd5171439e3b882642f5fbad5
Author:     Grzegorz Araminowicz <grzegorz.araminow...@collabora.com>
AuthorDate: Mon Sep 30 13:09:13 2019 +0200
Commit:     Grzegorz Araminowicz <grzegorz.araminow...@collabora.com>
CommitDate: Tue Oct 1 21:25:02 2019 +0200

    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.araminow...@collabora.com>

diff --git a/oox/inc/drawingml/textbody.hxx b/oox/inc/drawingml/textbody.hxx
index 835f1c34b792..38996abe03ea 100644
--- a/oox/inc/drawingml/textbody.hxx
+++ b/oox/inc/drawingml/textbody.hxx
@@ -62,6 +62,7 @@ public:
                             const TextCharacterProperties& 
rTextStyleProperties,
                             const TextListStylePtr& pMasterTextListStyle ) 
const;
     bool isEmpty() const;
+    OUString toString() const;
 
     void                ApplyStyleEmpty(
                             const ::oox::core::XmlFilterBase& rFilterBase,
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,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to