From 48053d44c4f7654226cbfe01e56da3276feed136 Mon Sep 17 00:00:00 2001 From: Doug Fales Date: Sat, 28 Oct 2006 22:09:14 +0000 Subject: [PATCH] Fixing nil time bug. --- lib/gpx/segment.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/gpx/segment.rb b/lib/gpx/segment.rb index 0cb68d4..6b895d6 100644 --- a/lib/gpx/segment.rb +++ b/lib/gpx/segment.rb @@ -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)