diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/TextInputChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/TextInputChannel.ets index 64de0365520ab8d460878afd71678be0e65e3601..b077d6b0fab48e669ec59857cce297d7d6f1ab16 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/TextInputChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/TextInputChannel.ets @@ -231,7 +231,7 @@ export class Configuration { throw new Error("Configuration JSON missing 'inputAction' property."); } - let fields:Array = null; + let fields:Array = new Array(); if (json.fields !== null && json.fields !== undefined) { fields = json.fields.map((field:ESObject):ESObject => Configuration.fromJson(field)); } diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/ListenableEditingState.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/ListenableEditingState.ets index cac4a34cb7bb9e6cd878f18da3573894081ddc4d..6396d2520ea410535ef7d638b8868146c7344d18 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/ListenableEditingState.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/ListenableEditingState.ets @@ -22,7 +22,7 @@ import TextInputChannel from '../../embedding/engine/systemchannels/TextInputCha const TAG = "ListenableEditingState"; export class ListenableEditingState { - private TextInputChannel: TextInputChannel|null = null ; + private TextInputChannel: TextInputChannel | null = null ; private client: number = 0 //Cache used to storage software keyboard input action private mStringCache: string; @@ -45,7 +45,7 @@ export class ListenableEditingState { private mComposingEndWhenBeginBatchEdit: number = 0; - constructor(TextInputChannel:TextInputChannel,client:number) { + constructor(TextInputChannel:TextInputChannel | null,client:number) { this.TextInputChannel = TextInputChannel; this.client = client this.mStringCache = ""; @@ -240,6 +240,10 @@ export class ListenableEditingState { } handleFunctionKey(functionKey: inputMethod.FunctionKey): void { + if(!this.TextInputChannel) + { + return + } switch (functionKey.enterKeyType) { case inputMethod.EnterKeyType.PREVIOUS: this.TextInputChannel.previous(this.client); diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets index 5a47a5062cbce23d30918306550588c06d57dc2e..f29018808a58be674da97260e25aa302902c6dcb 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets @@ -76,7 +76,7 @@ class TextInputMethodHandlerImpl implements TextInputMethodHandler { enterKeyType: 1 }}; this.plugin = plugin; - this.mEditable = new ListenableEditingState(null , 0); + this.mEditable = new ListenableEditingState(null, 0); this.inputMethodController = inputMethod.getController(); this.inputTarget = new InputTarget(Type.NO_TARGET, 0); }