xmloff/source/draw/shapeexport.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit a0d28d03ff40a77a2c88704a7b2bedb68e68563f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Sep 9 18:52:49 2021 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Sep 10 12:44:58 2021 +0200

    xmloff: ODF export: avoid mysterious crash while sorting shapes
    
    Apparently the draw page contains a null XShape.  That sounds like a bug
    but OTOH this sorting feature from commit
    9bc6160e0acbc78be998129ea55ed7e4529959faa isn't that important so let's
    sweep the problem under the rug.
    
    0       swlo.dll        
sw::GetZOrderLayer::operator()(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>
 const &)     
C:\cygwin64\home\buildslave\source\libo-core\sw\source\filter\xml\zorder.hxx:37
    1       mergedlo.dll    
xmloff::FixZOrder(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes>
 const &,std::function<unsigned int > const &)        
C:\cygwin64\home\buildslave\source\libo-core\xmloff\source\draw\shapeexport.cxx:1003
    2       swlo.dll        
SwXMLWriter::Write_(com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator>
 const &,rtl::OUString const &)       
C:\cygwin64\home\buildslave\source\libo-core\sw\source\filter\xml\wrtxml.cxx:190
    
    
https://crashreport.libreoffice.org/stats/crash_details/045adea4-c577-4164-9e69-bde5f892bd17
    
    Change-Id: I1e67dc1c354cb14717cf9667314d6752e1b4c295
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121860
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 455ca3b4e024..8c7ba1727a84 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1024,6 +1024,11 @@ void FixZOrder(uno::Reference<drawing::XShapes> const& 
xShapes,
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
         uno::Reference<beans::XPropertySet> const 
xShape(xShapes->getByIndex(i), uno::UNO_QUERY);
+        if (!xShape.is())
+        {
+            SAL_WARN("xmloff", "FixZOrder: null shape, cannot sort");
+            return;
+        }
         unsigned int const nLayer(rGetLayer(xShape));
         if (layers.size() <= nLayer)
         {

Reply via email to