[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 1 09:19:36 UTC 2021
sw/source/core/edit/autofmt.cxx | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
New commits:
commit 347c75832300cd7c00b61243e0137e159013c540
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Fri Jan 15 20:32:43 2021 +0300
Commit: Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Jun 1 11:18:58 2021 +0200
tdf#136704 sw autofmt: prevent crash if no nextNode
The second GetNextNode() was a nullptr
that was being dereferenced.
Now, when enter is pressed after some text followed by a colon,
that line is made into a heading3, and the new blank line is
properly using the text body paragraph style.
Change-Id: If10dc85e490ac57fc150b3d541f5033dfd5293bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109413
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit fea7b531a4c9e8326a644cccc26325b16585675a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115937
Tested-by: Michael Stahl <michael.stahl at allotropia.de>
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 3994cba5edb6..acec5eaaee76 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1898,11 +1898,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 );
}
More information about the Libreoffice-commits
mailing list