Handle empty text with no line metrics in RenderEditable._lineNumberFor (#93578)

This commit is contained in:
Jason Simmons 2021-11-15 12:55:32 -08:00 committed by GitHub
parent b8df406183
commit 245168f85c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2410,7 +2410,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
return MapEntry<int, Offset>(lineMetrics.lineNumber, Offset(offset.dx, lineMetrics.baseline));
}
}
assert(false, 'unable to find the line for $startPosition');
assert(startPosition.offset == 0, 'unable to find the line for $startPosition');
return MapEntry<int, Offset>(
math.max(0, metrics.length - 1),
Offset(offset.dx, metrics.isNotEmpty ? metrics.last.baseline + metrics.last.descent : 0.0),