From 3627434d2bf7265429d71845dbbc36c4cbd29d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 26 Jan 2014 15:15:17 +0100 Subject: [PATCH] MarkupParser: Make sure added paragraphs are valid They need to contain at least one TextSpan, even if empty. --- src/apps/haiku-depot/textview/MarkupParser.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/apps/haiku-depot/textview/MarkupParser.cpp b/src/apps/haiku-depot/textview/MarkupParser.cpp index 258025feb7..5c11c14dc6 100644 --- a/src/apps/haiku-depot/textview/MarkupParser.cpp +++ b/src/apps/haiku-depot/textview/MarkupParser.cpp @@ -290,6 +290,11 @@ MarkupParser::_FinishParagraph(bool isLast) if (!isLast) fCurrentParagraph.Append(TextSpan("\n", *fCurrentCharacterStyle)); + if (fCurrentParagraph.IsEmpty()) { + // Append empty span + fCurrentParagraph.Append(TextSpan("", fNormalStyle)); + } + fTextDocument->Append(fCurrentParagraph); fCurrentParagraph.Clear(); fCurrentParagraph.SetStyle(fParagraphStyle);