]> git.openstreetmap.org Git - rails.git/blobdiff - lib/gpx.rb
Don't update deactivates_at if block was already viewed
[rails.git] / lib / gpx.rb
index 3e1cb9afa6d9cf6da4ca51d80255576c3f25f309..45a4dcf5fc0bd62335ea0339409e2c1fbfd49e6d 100644 (file)
@@ -27,7 +27,7 @@ module GPX
             point.timestamp = Time.parse(reader.read_string).utc
           end
         when XML::Reader::TYPE_END_ELEMENT
-          if reader.name == "trkpt" && point && point.valid?
+          if reader.name == "trkpt" && point&.valid?
             point.altitude ||= 0
             yield point
             @actual_points += 1
@@ -57,7 +57,7 @@ module GPX
         when "application/x-bzip" then io = Bzip2::FFI::Reader.open(@file)
         end
 
-        parse_file(XML::Reader.io(io), &block)
+        parse_file(XML::Reader.io(io, :options => XML::Parser::Options::NOERROR), &block)
       end
     end