forked from firka/flutter
Fixing bug when ListenableEditingState is provided initialState with a valid composing range, android.view.inputmethod.BaseInputConnection.setComposingRegion(int, int) has NPE (flutter/engine#30916)
This commit is contained in:
@@ -60,9 +60,6 @@ class ListenableEditingState extends SpannableStringBuilder {
|
||||
public ListenableEditingState(
|
||||
@Nullable TextInputChannel.TextEditState initialState, @NonNull View view) {
|
||||
super();
|
||||
if (initialState != null) {
|
||||
setEditingState(initialState);
|
||||
}
|
||||
|
||||
Editable self = this;
|
||||
mDummyConnection =
|
||||
@@ -72,6 +69,10 @@ class ListenableEditingState extends SpannableStringBuilder {
|
||||
return self;
|
||||
}
|
||||
};
|
||||
|
||||
if (initialState != null) {
|
||||
setEditingState(initialState);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<TextEditingDelta> extractBatchTextEditingDeltas() {
|
||||
|
||||
@@ -42,6 +42,14 @@ public class ListenableEditingStateTest {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
// When provided valid composing range, should not fail
|
||||
new ListenableEditingState(
|
||||
new TextInputChannel.TextEditState("hello", 1, 4, 1, 4),
|
||||
new View(RuntimeEnvironment.application));
|
||||
}
|
||||
|
||||
// -------- Start: Test BatchEditing -------
|
||||
@Test
|
||||
public void testBatchEditing() {
|
||||
|
||||
Reference in New Issue
Block a user