[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - writerfilter/source

Caolán McNamara caolanm at redhat.com
Thu Apr 24 03:23:46 PDT 2014


 writerfilter/source/dmapper/NumberingManager.cxx |    5 +-
 writerfilter/source/rtftok/rtfsdrimport.cxx      |   48 +++++++++++++++++------
 2 files changed, 40 insertions(+), 13 deletions(-)

New commits:
commit 96de8f554838c00d1c6705d27681d44e8e0fd704
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 22 17:23:26 2014 +0100

    Resolves: rhbz#1089377 crash on loading a specific rtf
    
    (cherry picked from commit 5aeaba2e6592dab0404301dcef644144f82ffcbf)
    
    Change-Id: I26864f3a2247f5d7184f395cfed91eaf92e36295
    Reviewed-on: https://gerrit.libreoffice.org/9131
    Tested-by: David Tardon <dtardon at redhat.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 7a1787c..6038df6 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -531,6 +531,9 @@ OUString ListDef::GetStyleName( sal_Int32 nId )
 
 uno::Sequence< uno::Sequence< beans::PropertyValue > > ListDef::GetPropertyValues( )
 {
+    if (!m_pAbstractDef)
+        return uno::Sequence< uno::Sequence< beans::PropertyValue > >();
+
     // [1] Call the same method on the abstract list
     uno::Sequence< uno::Sequence< beans::PropertyValue > > aAbstract = m_pAbstractDef->GetPropertyValues( );
 
@@ -603,7 +606,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
 
             uno::Sequence< uno::Sequence< beans::PropertyValue > > aProps = GetPropertyValues( );
 
-            sal_Int32 nAbstLevels = m_pAbstractDef->Size( );
+            sal_Int32 nAbstLevels = m_pAbstractDef ? m_pAbstractDef->Size() : 0;
             sal_Int16 nLevel = 0;
             while ( nLevel < nAbstLevels )
             {
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index fa147d7..7788414 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -194,16 +194,16 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
         xPropertySet->setPropertyValue("RotateAngle", uno::makeAny(sal_Int32(NormAngle360(nRotation * -1))));
     }
 
-    if (nHoriOrient != 0)
+    if (nHoriOrient != 0 && xPropertySet.is())
         xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
-    if (nVertOrient != 0)
+    if (nVertOrient != 0 && xPropertySet.is())
         xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
-    if (obFitShapeToText)
+    if (obFitShapeToText && xPropertySet.is())
     {
         xPropertySet->setPropertyValue("SizeType", uno::makeAny(*obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX));
         xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(*obFitShapeToText));
     }
-    if (!bFilled)
+    if (!bFilled && xPropertySet.is())
     {
         if (m_bTextFrame)
             xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100)));
@@ -459,21 +459,45 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
         }
         // These are in EMU, convert to mm100.
         else if (i->first == "dxTextLeft")
-            xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "dyTextTop")
-            xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "dxTextRight")
-            xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "dyTextBottom")
-            xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "dxWrapDistLeft")
-            xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "dyWrapDistTop")
-            xPropertySet->setPropertyValue("TopMargin", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("TopMargin", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "dxWrapDistRight")
-            xPropertySet->setPropertyValue("RightMargin", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("RightMargin", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "dyWrapDistBottom")
-            xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(i->second.toInt32() / 360));
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(i->second.toInt32() / 360));
+        }
         else if (i->first == "fillType")
         {
             switch (i->second.toInt32())


More information about the Libreoffice-commits mailing list