Fixing nil time bug.

master
Doug Fales 2006-10-28 22:09:14 +00:00
parent 371a3fa0b9
commit 48053d44c4
1 changed files with 4 additions and 2 deletions

View File

@ -48,8 +48,10 @@ module GPX
unless segment_element.is_a?(Text)
XPath.each(segment_element, "child::trkpt") do |trkpt|
pt = TrackPoint.new(:element => trkpt, :segment => self)
@earliest_point = pt if(@earliest_point.nil? or pt.time < @earliest_point.time)
@latest_point = pt if(@latest_point.nil? or pt.time > @latest_point.time)
unless pt.time.nil?
@earliest_point = pt if(@earliest_point.nil? or pt.time < @earliest_point.time)
@latest_point = pt if(@latest_point.nil? or pt.time > @latest_point.time)
end
unless pt.elevation.nil?
@lowest_point = pt if(@lowest_point.nil? or pt.elevation < @lowest_point.elevation)
@highest_point = pt if(@highest_point.nil? or pt.elevation > @highest_point.elevation)