mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add basecase checking to prevent segfault in GetWordBoundary().
Change-Id: I5ca93c0c15ef5dd3dbc6a5937f8b21338acf884d
This commit is contained in:
parent
20914d0e91
commit
13af3dc89c
@ -819,6 +819,8 @@ size_t Paragraph::GetGlyphPositionAtCoordinate(double dx, double dy) const {
|
||||
|
||||
SkIPoint Paragraph::GetWordBoundary(size_t offset) const {
|
||||
// TODO(garyq): Consider punctuation as separate words.
|
||||
if (text_.size() == 0)
|
||||
return SkIPoint::Make(0, 0);
|
||||
return SkIPoint::Make(
|
||||
minikin::getPrevWordBreakForCache(text_.data(), offset + 1, text_.size()),
|
||||
minikin::getNextWordBreakForCache(text_.data(), offset, text_.size()));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user