gpx_parser: Fix crash if gpx doesn't contain timings
Signed-off-by: Thomas Klaehn <thomas.klaehn@u-blox.com>
This commit is contained in:
@@ -34,10 +34,14 @@ class Track(object):
|
||||
' ' + str(segment.points[i].longitude))
|
||||
seg.distance += distance.distance(point1, point2).meters
|
||||
|
||||
if self.duration is None:
|
||||
self.duration = seg.end_time - seg.start_time
|
||||
else:
|
||||
self.duration += seg.end_time - seg.start_time
|
||||
try:
|
||||
if self.duration is None:
|
||||
self.duration = seg.end_time - seg.start_time
|
||||
else:
|
||||
self.duration += seg.end_time - seg.start_time
|
||||
except Exception:
|
||||
# TODO: Add logging mechanism.
|
||||
pass
|
||||
self.end_time = seg.end_time
|
||||
self.distance += seg.distance
|
||||
self.avg_speed = self.distance / self.duration.total_seconds() * 3.6
|
||||
|
Reference in New Issue
Block a user