Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>

Changes to be committed:
This commit is contained in:
ma-shaoyin 2024-04-03 14:34:36 +08:00
parent ab25118245
commit 84af969a2e
2 changed files with 3 additions and 5 deletions

View File

@ -142,9 +142,7 @@ export default class ServiceExtAbility extends ServiceExtensionAbility {
}
public async releaseContext(): Promise<void> {
if (this.mContext && this.extensionWin) {
await this.extensionWin.destroyWindow();
await this.mContext.terminateSelf();
}
await this.extensionWin?.destroyWindow();
await this.mContext?.terminateSelf();
}
};

View File

@ -91,7 +91,7 @@ struct Index {
message: 'switch success', duration: 200
});
setTimeout(() => {
context.terminateSelf();
context?.terminateSelf();
}, EXIT_TIME);
}).catch((err: BusinessError) => {
if (!err) {