diff --git a/frameworks/src/bundle_test_tool.cpp b/frameworks/src/bundle_test_tool.cpp index 43479fd4a20aae529a79d1f83a38c9924fac634d..0472e1b778b61c41acd25cc1c575ad00615f1973 100644 --- a/frameworks/src/bundle_test_tool.cpp +++ b/frameworks/src/bundle_test_tool.cpp @@ -1376,10 +1376,7 @@ ErrCode BundleTestTool::RunAsCheckCommand() return OHOS::ERR_INVALID_VALUE; } if (option == -1) { - // When scanning the first argument if ((counter == 1) && (strcmp(argv_[optind], cmd_.c_str()) == 0)) { - // 'CheckAbilityEnableInstall' with no option: CheckAbilityEnableInstall - // 'CheckAbilityEnableInstall' with a wrong argument: CheckAbilityEnableInstall APP_LOGD("'CheckAbilityEnableInstall' with no option."); return OHOS::ERR_INVALID_VALUE; } @@ -1403,7 +1400,9 @@ ErrCode BundleTestTool::RunAsCheckCommand() break; } case 'u': { - userId = std::stoi(optarg); + if (!OHOS::StrToInt(optarg, userId)) { + APP_LOGD("userId strToInt failed"); + } break; } default: {