diff --git a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc index 0dc0c60f60..770a333b59 100644 --- a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -739,7 +739,7 @@ void Paragraph::Layout(double width, bool force) { // Add extra empty metrics for skipped whitespace at line end. This allows // GetRectsForRange to properly draw empty rects at the ends of lines with // truncated whitespace. - if (line_end_index < line_range.end) { + if (line_end_index < line_range.end && !line_code_unit_runs.empty()) { std::vector empty_glyph_positions; double end_x = line_code_unit_runs.back().positions.back().x_pos.end; for (size_t index = line_end_index; index < line_range.end; ++index) {