bool ManifestParserImpl::ValidateAppManifest(std::string* error) {
const ManifestHandlerMap& handlers = registry_->handlers();
- for (auto p : handlers) {
+ for (const auto& p : handlers) {
auto handler = p.second;
if (manifest_data_.find(p.first) != manifest_data_.end() &&
!handler->Validate(*GetManifestData(handler->Key()).get(),
const ManifestHandlerMap& handlers = registry_->handlers();
const ManifestHandlerOrderMap& order_map =
registry_->get_manifest_handlers_order_map();
- for (auto p : handlers) {
+ for (const auto& p : handlers) {
auto handler = p.second;
if (manifest_->HasPath(p.first) ||
handler->AlwaysParseForKey()) {
- handlers_by_order[order_map.find(handler)->second] = handler;
+ const auto& it = order_map.find(handler);
+ if (it != order_map.end()) {
+ handlers_by_order[it->second] = handler;
+ } else {
+ *error = std::string("'") + handler->Key() +
+ "'' does not exist in handlers_by_order map";
+ return false;
+ }
}
}
- for (auto handler : handlers_by_order) {
+ for (const auto& handler : handlers_by_order) {
std::shared_ptr<ManifestData> output;
if (handler.second->Parse(*manifest_.get(), &output, error)) {
if (output)
}
} // namespace parser
-
-