1 |
From 195e3a757e98c58ee9e0dd428cd3dbce58ed99b7 Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Tue, 22 Apr 2014 17:23:26 +0100 |
4 |
Subject: [PATCH] Resolves: rhbz#1089377 crash on loading a specific rtf |
5 |
|
6 |
(cherry picked from commit 5aeaba2e6592dab0404301dcef644144f82ffcbf) |
7 |
|
8 |
Change-Id: I26864f3a2247f5d7184f395cfed91eaf92e36295 |
9 |
--- |
10 |
writerfilter/source/dmapper/NumberingManager.cxx | 5 ++- |
11 |
writerfilter/source/rtftok/rtfsdrimport.cxx | 48 ++++++++++++++++++------ |
12 |
2 files changed, 40 insertions(+), 13 deletions(-) |
13 |
|
14 |
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx |
15 |
index 7a1787c..6038df6 100644 |
16 |
--- a/writerfilter/source/dmapper/NumberingManager.cxx |
17 |
+++ b/writerfilter/source/dmapper/NumberingManager.cxx |
18 |
@@ -531,6 +531,9 @@ OUString ListDef::GetStyleName( sal_Int32 nId ) |
19 |
|
20 |
uno::Sequence< uno::Sequence< beans::PropertyValue > > ListDef::GetPropertyValues( ) |
21 |
{ |
22 |
+ if (!m_pAbstractDef) |
23 |
+ return uno::Sequence< uno::Sequence< beans::PropertyValue > >(); |
24 |
+ |
25 |
// [1] Call the same method on the abstract list |
26 |
uno::Sequence< uno::Sequence< beans::PropertyValue > > aAbstract = m_pAbstractDef->GetPropertyValues( ); |
27 |
|
28 |
@@ -603,7 +606,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, |
29 |
|
30 |
uno::Sequence< uno::Sequence< beans::PropertyValue > > aProps = GetPropertyValues( ); |
31 |
|
32 |
- sal_Int32 nAbstLevels = m_pAbstractDef->Size( ); |
33 |
+ sal_Int32 nAbstLevels = m_pAbstractDef ? m_pAbstractDef->Size() : 0; |
34 |
sal_Int16 nLevel = 0; |
35 |
while ( nLevel < nAbstLevels ) |
36 |
{ |
37 |
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx |
38 |
index fa147d7..7788414 100644 |
39 |
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx |
40 |
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx |
41 |
@@ -194,16 +194,16 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin |
42 |
xPropertySet->setPropertyValue("RotateAngle", uno::makeAny(sal_Int32(NormAngle360(nRotation * -1)))); |
43 |
} |
44 |
|
45 |
- if (nHoriOrient != 0) |
46 |
+ if (nHoriOrient != 0 && xPropertySet.is()) |
47 |
xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient)); |
48 |
- if (nVertOrient != 0) |
49 |
+ if (nVertOrient != 0 && xPropertySet.is()) |
50 |
xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient)); |
51 |
- if (obFitShapeToText) |
52 |
+ if (obFitShapeToText && xPropertySet.is()) |
53 |
{ |
54 |
xPropertySet->setPropertyValue("SizeType", uno::makeAny(*obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX)); |
55 |
xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(*obFitShapeToText)); |
56 |
} |
57 |
- if (!bFilled) |
58 |
+ if (!bFilled && xPropertySet.is()) |
59 |
{ |
60 |
if (m_bTextFrame) |
61 |
xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100))); |
62 |
@@ -459,21 +459,45 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) |
63 |
} |
64 |
// These are in EMU, convert to mm100. |
65 |
else if (i->first == "dxTextLeft") |
66 |
- xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
67 |
+ { |
68 |
+ if (xPropertySet.is()) |
69 |
+ xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
70 |
+ } |
71 |
else if (i->first == "dyTextTop") |
72 |
- xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
73 |
+ { |
74 |
+ if (xPropertySet.is()) |
75 |
+ xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
76 |
+ } |
77 |
else if (i->first == "dxTextRight") |
78 |
- xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
79 |
+ { |
80 |
+ if (xPropertySet.is()) |
81 |
+ xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
82 |
+ } |
83 |
else if (i->first == "dyTextBottom") |
84 |
- xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
85 |
+ { |
86 |
+ if (xPropertySet.is()) |
87 |
+ xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(i->second.toInt32() / 360)); |
88 |
+ } |
89 |
else if (i->first == "dxWrapDistLeft") |
90 |
- xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(i->second.toInt32() / 360)); |
91 |
+ { |
92 |
+ if (xPropertySet.is()) |
93 |
+ xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(i->second.toInt32() / 360)); |
94 |
+ } |
95 |
else if (i->first == "dyWrapDistTop") |
96 |
- xPropertySet->setPropertyValue("TopMargin", uno::makeAny(i->second.toInt32() / 360)); |
97 |
+ { |
98 |
+ if (xPropertySet.is()) |
99 |
+ xPropertySet->setPropertyValue("TopMargin", uno::makeAny(i->second.toInt32() / 360)); |
100 |
+ } |
101 |
else if (i->first == "dxWrapDistRight") |
102 |
- xPropertySet->setPropertyValue("RightMargin", uno::makeAny(i->second.toInt32() / 360)); |
103 |
+ { |
104 |
+ if (xPropertySet.is()) |
105 |
+ xPropertySet->setPropertyValue("RightMargin", uno::makeAny(i->second.toInt32() / 360)); |
106 |
+ } |
107 |
else if (i->first == "dyWrapDistBottom") |
108 |
- xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(i->second.toInt32() / 360)); |
109 |
+ { |
110 |
+ if (xPropertySet.is()) |
111 |
+ xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(i->second.toInt32() / 360)); |
112 |
+ } |
113 |
else if (i->first == "fillType") |
114 |
{ |
115 |
switch (i->second.toInt32()) |
116 |
-- |
117 |
1.9.0 |
118 |
|