Merge "Guard against calls to getTextAfterCursor() in text that has no cursor."

This commit is contained in:
Eric Fischer
2010-03-08 16:59:48 -08:00
committed by Android (Google) Code Review

View File

@@ -328,6 +328,11 @@ public class BaseInputConnection implements InputConnection {
b = tmp;
}
// Guard against the case where the cursor has not been positioned yet.
if (b < 0) {
b = 0;
}
if (b + length > content.length()) {
length = content.length() - b;
}