diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-04-22 17:23:26 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-04-24 10:23:19 +0000 |
commit | 96de8f554838c00d1c6705d27681d44e8e0fd704 (patch) | |
tree | f295f6e509d20d3a8cf1a41063dce62dc6acd0a5 /writerfilter | |
parent | c93a3a9f3310d8b6092238a0d81b9195fcb659ee (diff) |
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@redhat.com>
Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 48 |
2 files changed, 40 insertions, 13 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 7a1787c49358..6038df6fb3bb 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 fa147d77445c..778841446e3e 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()) |