summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/edit/autofmt.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 591c4a988d20..a3925246f32f 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1895,11 +1895,14 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl )
JoinPrevPara();
DeleteLeadingTrailingBlanks( true, false );
- const SwTextFrame *const pNextFrame = GetNextNode(false);
- (void)DeleteJoinCurNextPara(pNextFrame, true);
-
+ const SwTextFrame* pNextFrame = GetNextNode(false);
+ if (pNextFrame->GetNext())
+ {
+ (void)DeleteJoinCurNextPara(pNextFrame, true);
+ pNextFrame = GetNextNode(false);
+ }
m_aDelPam.DeleteMark();
- m_aDelPam.GetPoint()->nNode = *GetNextNode(false)->GetTextNodeForParaProps();
+ m_aDelPam.GetPoint()->nNode = *pNextFrame->GetTextNodeForParaProps();
m_aDelPam.GetPoint()->nContent.Assign( m_aDelPam.GetContentNode(), 0 );
m_pDoc->SetTextFormatColl( m_aDelPam, &rNxtColl );
}