Fix crash on calling removeSelection with showing selection handlers
A crash occured on updating after calling removeSelection with showing selection handlers. This was because some selection-handler code didn't consider the case the selection index was -1 (-1 means there is no selection). This patch fixes this crash. Bug: 23299977 Change-Id: I736d315e073f773aec597522203015205a8da42b
This commit is contained in:
@@ -4253,10 +4253,14 @@ public class Editor {
|
||||
positionAtCursorOffset(offset, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param offset Cursor offset. Must be in [-1, length].
|
||||
* @param parentScrolled If the parent has been scrolled or not.
|
||||
*/
|
||||
@Override
|
||||
protected void positionAtCursorOffset(int offset, boolean parentScrolled) {
|
||||
super.positionAtCursorOffset(offset, parentScrolled);
|
||||
mInWord = !getWordIteratorWithText().isBoundary(offset);
|
||||
mInWord = (offset != -1) && !getWordIteratorWithText().isBoundary(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -4489,10 +4493,14 @@ public class Editor {
|
||||
positionAtCursorOffset(offset, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param offset Cursor offset. Must be in [-1, length].
|
||||
* @param parentScrolled If the parent has been scrolled or not.
|
||||
*/
|
||||
@Override
|
||||
protected void positionAtCursorOffset(int offset, boolean parentScrolled) {
|
||||
super.positionAtCursorOffset(offset, parentScrolled);
|
||||
mInWord = !getWordIteratorWithText().isBoundary(offset);
|
||||
mInWord = (offset != -1) && !getWordIteratorWithText().isBoundary(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user