diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index bbe302c232d42b694786fe37243a915024e4ad2c..f5d7cb6628e12c4747750d55455f7fc8e51dd466 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -221,12 +221,9 @@ bool InputMethodSystemAbility::IsValidBundleName(const std::string &bundleName) return false; } - for (auto &prop : props) { - if (prop.name == bundleName) { - return true; - } - } - return false; + return std::any_of(props.begin(), props.end(), [&bundleName](const auto &prop) { + return prop.name == bundleName; + }); } std::string InputMethodSystemAbility::GetRestoreBundleName(MessageParcel &data)