summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-09-18 20:05:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-09-18 20:05:01 +0000
commit4c4650cb1bf0bfbef562ba75f052f3dbd7761fc0 (patch)
tree7b06e394c8405e8e36a40c202ec54b70af5c62d1
parente9eb25e1b41d556d7945c0913a2f73c4f81423e2 (diff)
parent7554fa20b567f7e5b3e25713d18fe591a50c2f43 (diff)
Merge "Do not compute outside given range in TextLine"
-rw-r--r--core/java/android/text/TextLine.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java
index 86651060a394..1c50d73c4953 100644
--- a/core/java/android/text/TextLine.java
+++ b/core/java/android/text/TextLine.java
@@ -276,6 +276,7 @@ public class TextLine {
final int runCount = mDirections.getRunCount();
for (int runIndex = 0; runIndex < runCount; runIndex++) {
final int runStart = mDirections.getRunStart(runIndex);
+ if (runStart > mLen) break;
final int runLimit = Math.min(runStart + mDirections.getRunLength(runIndex), mLen);
final boolean runIsRtl = mDirections.isRunRtl(runIndex);
@@ -360,6 +361,7 @@ public class TextLine {
float h = 0;
for (int runIndex = 0; runIndex < mDirections.getRunCount(); runIndex++) {
final int runStart = mDirections.getRunStart(runIndex);
+ if (runStart > mLen) break;
final int runLimit = Math.min(runStart + mDirections.getRunLength(runIndex), mLen);
final boolean runIsRtl = mDirections.isRunRtl(runIndex);
@@ -417,6 +419,7 @@ public class TextLine {
float h = 0;
for (int runIndex = 0; runIndex < mDirections.getRunCount(); runIndex++) {
final int runStart = mDirections.getRunStart(runIndex);
+ if (runStart > mLen) break;
final int runLimit = Math.min(runStart + mDirections.getRunLength(runIndex), mLen);
final boolean runIsRtl = mDirections.isRunRtl(runIndex);