Add basecase checking to prevent segfault in GetWordBoundary().
Change-Id: I5ca93c0c15ef5dd3dbc6a5937f8b21338acf884d
This commit is contained in:
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user