1 |
From 3524727db0f3cfecf3a47046795c527808c10c3e Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Thu, 23 Jun 2011 15:14:00 +0100 |
4 |
Subject: [PATCH] Related: #i58612# don't crash anyway |
5 |
|
6 |
--- |
7 |
sw/source/core/text/frmform.cxx | 11 ++++++----- |
8 |
sw/source/core/text/inftxt.cxx | 3 ++- |
9 |
sw/source/core/text/txtfly.cxx | 6 ++++-- |
10 |
sw/source/core/text/txtfrm.cxx | 7 +++++-- |
11 |
4 files changed, 17 insertions(+), 10 deletions(-) |
12 |
|
13 |
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx |
14 |
index 6a4be32..6b3b9cc 100755 |
15 |
--- a/sw/source/core/text/frmform.cxx |
16 |
+++ b/sw/source/core/text/frmform.cxx |
17 |
@@ -1463,10 +1463,11 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, |
18 |
|
19 |
if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() ) |
20 |
{ |
21 |
- const SwLineLayout* pLine; |
22 |
+ SwTxtFrm *pMaster = FindMaster(); |
23 |
+ OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" ); |
24 |
+ const SwLineLayout* pLine=NULL; |
25 |
+ if (pMaster) |
26 |
{ |
27 |
- SwTxtFrm *pMaster = FindMaster(); |
28 |
- OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" ); |
29 |
if( !pMaster->HasPara() ) |
30 |
pMaster->GetFormatted(); |
31 |
SwTxtSizeInfo aInf( pMaster ); |
32 |
@@ -1474,8 +1475,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, |
33 |
aMasterLine.Bottom(); |
34 |
pLine = aMasterLine.GetCurr(); |
35 |
} |
36 |
- SwLinePortion* pRest = |
37 |
- rLine.MakeRestPortion( pLine, GetOfst() ); |
38 |
+ SwLinePortion* pRest = pLine ? |
39 |
+ rLine.MakeRestPortion(pLine, GetOfst()) : NULL; |
40 |
if( pRest ) |
41 |
rInf.SetRest( pRest ); |
42 |
else |
43 |
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx |
44 |
index 570b3c6..a76d746 100644 |
45 |
--- a/sw/source/core/text/inftxt.cxx |
46 |
+++ b/sw/source/core/text/inftxt.cxx |
47 |
@@ -1465,7 +1465,8 @@ void SwTxtFormatInfo::Init() |
48 |
if ( GetTxtFrm()->IsFollow() ) |
49 |
{ |
50 |
const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster(); |
51 |
- const SwLinePortion* pTmpPara = pMaster->GetPara(); |
52 |
+ OSL_ENSURE(pMaster, "pTxtFrm without Master"); |
53 |
+ const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : NULL; |
54 |
|
55 |
// there is a master for this follow and the master does not have |
56 |
// any contents (especially it does not have a number portion) |
57 |
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx |
58 |
index 2d21ece..fbff110 100644 |
59 |
--- a/sw/source/core/text/txtfly.cxx |
60 |
+++ b/sw/source/core/text/txtfly.cxx |
61 |
@@ -890,7 +890,7 @@ sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const |
62 |
const SwCntntFrm* SwTxtFly::_GetMaster() |
63 |
{ |
64 |
pMaster = pCurrFrm; |
65 |
- while( pMaster->IsFollow() ) |
66 |
+ while( pMaster && pMaster->IsFollow() ) |
67 |
pMaster = (SwCntntFrm*)pMaster->FindMaster(); |
68 |
return pMaster; |
69 |
} |
70 |
@@ -1551,7 +1551,9 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList() |
71 |
SwTwips SwTxtFly::CalcMinBottom() const |
72 |
{ |
73 |
SwTwips nRet = 0; |
74 |
- const SwSortedObjs *pDrawObj = GetMaster()->GetDrawObjs(); |
75 |
+ const SwCntntFrm *pLclMaster = GetMaster(); |
76 |
+ OSL_ENSURE(pLclMaster, "SwTxtFly without master"); |
77 |
+ const SwSortedObjs *pDrawObj = pLclMaster ? pLclMaster->GetDrawObjs() : NULL; |
78 |
const sal_uInt32 nCount = pDrawObj ? pDrawObj->Count() : 0; |
79 |
if( nCount ) |
80 |
{ |
81 |
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx |
82 |
index 6e5f764..9e4a237 100644 |
83 |
--- a/sw/source/core/text/txtfrm.cxx |
84 |
+++ b/sw/source/core/text/txtfrm.cxx |
85 |
@@ -646,9 +646,12 @@ void SwTxtFrm::HideAndShowObjects() |
86 |
} |
87 |
} |
88 |
|
89 |
- if ( IsFollow() ) |
90 |
+ if (IsFollow()) |
91 |
{ |
92 |
- FindMaster()->HideAndShowObjects(); |
93 |
+ SwTxtFrm *pMaster = FindMaster(); |
94 |
+ OSL_ENSURE(pMaster, "SwTxtFrm without master"); |
95 |
+ if (pMaster) |
96 |
+ pMaster->HideAndShowObjects(); |
97 |
} |
98 |
} |
99 |
|
100 |
-- |
101 |
1.7.6.4 |
102 |
|