diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets index 2c7c2522fcd119c87bf7e6c2831297c6d0e59548..86a3fab7a074a579a18e7bc980d009596dce26c8 100644 --- a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets @@ -61,7 +61,7 @@ struct Index { .margin(5) .onClick((e) => { accessibility.getAbilityLists('all', 'enable', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.error(LOG_PREFIX + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets index 70340ca88583c613c555e286b5f872560f7cc909..d30a8da7cd0c317f600b611e7656540b10a25a28 100644 --- a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets @@ -52,7 +52,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('spoken', 'install', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -98,7 +98,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('audible', 'install', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -144,7 +144,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('visual', 'install', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -190,7 +190,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('haptic', 'install', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -236,7 +236,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('generic', 'install', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -282,7 +282,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('all', 'enable', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -306,7 +306,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('all', 'enable', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -333,7 +333,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('all', 'enable', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -360,7 +360,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('all', 'enable', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.error(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -514,7 +514,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('all', 'disable', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return } @@ -560,7 +560,7 @@ export default function abilityTest() { disableAbility(logTag, [AUDIBLE_BUNDLE_NAME]) setTimeout(() => { accessibility.getAbilityLists('all', 'disable', (err, data) => { - if (err.code != 0) { + if (err && err.code != 0) { console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) return }