Skip to content

Commit b0a3c74

Browse files
authored
Check for empty line before adding empty 'padding' metrics (flutter#7185)
1 parent 9c6d7f5 commit b0a3c74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

third_party/txt/src/txt/paragraph.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ void Paragraph::Layout(double width, bool force) {
739739
// Add extra empty metrics for skipped whitespace at line end. This allows
740740
// GetRectsForRange to properly draw empty rects at the ends of lines with
741741
// truncated whitespace.
742-
if (line_end_index < line_range.end) {
742+
if (line_end_index < line_range.end && !line_code_unit_runs.empty()) {
743743
std::vector<GlyphPosition> empty_glyph_positions;
744744
double end_x = line_code_unit_runs.back().positions.back().x_pos.end;
745745
for (size_t index = line_end_index; index < line_range.end; ++index) {

0 commit comments

Comments
 (0)