summaryrefslogtreecommitdiffstats
path: root/core/java/android/text/TextUtils.java
diff options
context:
space:
mode:
authorMark Wagner <mxw@google.com>2010-03-01 09:24:59 -0800
committerMark Wagner <mxw@google.com>2010-03-01 09:28:29 -0800
commit60919953ce80dbf75673837ea51497c84da7ac78 (patch)
tree8432d30247e1766752f2bf0961330961db808654 /core/java/android/text/TextUtils.java
parent7c02ef117e6720ca2c24fab6523e9c4bd665e26c (diff)
downloadframeworks_base-60919953ce80dbf75673837ea51497c84da7ac78.zip
frameworks_base-60919953ce80dbf75673837ea51497c84da7ac78.tar.gz
frameworks_base-60919953ce80dbf75673837ea51497c84da7ac78.tar.bz2
check offset and don't crash
Diffstat (limited to 'core/java/android/text/TextUtils.java')
-rw-r--r--core/java/android/text/TextUtils.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index afb22ac..9589bf3 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -1557,13 +1557,17 @@ public class TextUtils {
* @param reqModes The modes to be checked: may be any combination of
* {@link #CAP_MODE_CHARACTERS}, {@link #CAP_MODE_WORDS}, and
* {@link #CAP_MODE_SENTENCES}.
- *
+ *
* @return Returns the actual capitalization modes that can be in effect
* at the current position, which is any combination of
* {@link #CAP_MODE_CHARACTERS}, {@link #CAP_MODE_WORDS}, and
* {@link #CAP_MODE_SENTENCES}.
*/
public static int getCapsMode(CharSequence cs, int off, int reqModes) {
+ if (off < 0) {
+ return 0;
+ }
+
int i;
char c;
int mode = 0;