diff options
-rw-r--r-- | graphics/java/android/graphics/Paint.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index 1da198c..d3cb9b1 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -2120,9 +2120,9 @@ public class Paint { int contextLen = contextEnd - contextStart; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); - int result = getTextRunCursor(buf, 0, contextLen, dir, offset - contextStart, cursorOpt); + int relPos = getTextRunCursor(buf, 0, contextLen, dir, offset - contextStart, cursorOpt); TemporaryBuffer.recycle(buf); - return result; + return (relPos == -1) ? -1 : relPos + contextStart; } /** |