diff options
| -rw-r--r-- | core/jni/android/graphics/TextLayoutCache.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 86ae7d2ae05f..0d336eacf243 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -620,7 +620,9 @@ void TextLayoutCacheValue::getGlyphsIndexAndCount(size_t start, size_t count, si return; } *outStartIndex = mLogClusters[start]; - *outGlyphsCount = mLogClusters[start + count - 1] - mLogClusters[start] + 1; + size_t endIndex = (start + count >= mAdvances.size()) ? + mGlyphs.size() : mLogClusters[start + count]; + *outGlyphsCount = endIndex - *outStartIndex; #if DEBUG_GLYPHS LOGD("getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d", start, count, *outStartIndex, *outGlyphsCount); |