Skip to content

Commit

Permalink
#615 Don't try to create a box from an empty line-break result.
Browse files Browse the repository at this point in the history
This now triggers the endless loop detection code and crashes instead of infinite loop. To fix this completely we need to also fix the float clearing algorithm.
  • Loading branch information
danfickle committed Dec 10, 2020
1 parent 7373154 commit 6d9fac9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ public static LineBreakResult breakText(LayoutContext c,
break LOOP;
} else {
// We may be at the end of the line, so pick up at next line.
// FIXME: This is very dangerous and has led to infinite
// loops. Needs review.
context.setEnd(savedEnd);
break LOOP;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ private static StartInlineTextResult startInlineText(
}

if (!lbContext.isUnbreakable() ||
(lbContext.isUnbreakable() && !current.line.isContainsContent())) {
(lbContext.isUnbreakable() &&
!current.line.isContainsContent() &&
lbContext.getEnd() > lbContext.getStart())) {
// We can use the inline text by adding it to the current inline layout box.
// We also mark the text as consumed by the line break context and reduce the width
// we have remaining on this line.
Expand Down

0 comments on commit 6d9fac9

Please sign in to comment.