X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f1c6a87aa137c11d0aff5a4b0e563ac2c2a8f82d..abca51e4d8a51cb484598840a1b2459c651e1e67:/app/models/changeset.rb?ds=inline diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 990eae407..9db213e77 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -83,11 +83,13 @@ class Changeset < 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/changeset") - doc.find("//osm/changeset").each do |pt| - return Changeset.from_xml_node(pt, create) + if pt + Changeset.from_xml_node(pt, create) + else + raise OSM::APIBadXMLError.new("changeset", xml, "XML doesn't contain an osm/changeset element.") end - raise OSM::APIBadXMLError.new("changeset", xml, "XML doesn't contain an osm/changeset element.") rescue LibXML::XML::Error, ArgumentError => e raise OSM::APIBadXMLError.new("changeset", xml, e.message) end