X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/461f99dfe03ed0dfea2d973378e0ace70134c199..c8e21c409c9bec446f0caa2526d5b07861bb3299:/app/models/node.rb?ds=inline diff --git a/app/models/node.rb b/app/models/node.rb index 4d48112fc..52c4b6d67 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -74,11 +74,13 @@ class Node < ApplicationRecord def self.from_xml(xml, create = false) p = XML::Parser.string(xml, :options => XML::Parser::Options::NOERROR) doc = p.parse + pt = doc.find_first("//osm/node") - doc.find("//osm/node").each do |pt| - return Node.from_xml_node(pt, create) + if pt + Node.from_xml_node(pt, create) + else + raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/node element.") end - raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/node element.") rescue LibXML::XML::Error, ArgumentError => e raise OSM::APIBadXMLError.new("node", xml, e.message) end