diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterEngineConnectionRegistry.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterEngineConnectionRegistry.ets index ca424fc894cc3241269a88044e87c805ec257195..b864a5b3fa64102f84526247b05076e2640c8312 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterEngineConnectionRegistry.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterEngineConnectionRegistry.ets @@ -149,7 +149,11 @@ export default class FlutterEngineConnectionRegistry implements PluginRegistry, detachFromAbility(): void { if (this.isAttachedToAbility()) { - this.abilityAwarePlugins.forEach(abilityAware => abilityAware.onDetachedFromAbility()) + try { + this.abilityAwarePlugins.forEach(abilityAware => abilityAware.onDetachedFromAbility()) + } catch (e) { + Log.e(TAG, "abilityAwarePlugins DetachedFromAbility failed, msg:" + e); + } this.detachFromAbilityInternal(); } else { Log.e(TAG, "Attempted to detach plugins from an Ability when no Ability was attached.");