From 08cb38554f441d87af5026420781085886572bdb Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Fri, 13 Dec 2013 10:52:46 -0800 Subject: [PATCH] Bug fix, fix importing markers --- .../io/file/importer/AbstractFileTrackImporter.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/importer/AbstractFileTrackImporter.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/importer/AbstractFileTrackImporter.java index 4d01eb1f1..1cb51d7f1 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/importer/AbstractFileTrackImporter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/importer/AbstractFileTrackImporter.java @@ -256,6 +256,14 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track waypoint = null; } else { // The waypoint location time matches the track point time + + if (!LocationUtils.isValidLocation(location)) { + // Invalid location, load the next location + location = null; + continue; + } + + // Valid location if (location.getLatitude() == waypoint.getLocation().getLatitude() && location.getLongitude() == waypoint.getLocation().getLongitude()) { @@ -285,6 +293,8 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track -1L, -1L, location, tripStatistics, waypoint.getPhotoUrl()); myTracksProviderUtils.insertWaypoint(newWaypoint); } + + // Load the next waypoint waypoint = null; } }