aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/files/GPXParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/files/GPXParser.java')
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 9eab5df..72fd63f 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -305,21 +305,20 @@ public abstract class GPXParser extends FileParser {
// lookup cache for waypoint in already parsed caches
final cgCache cacheForWaypoint = result.get(cacheGeocodeForWaypoint);
if (cacheForWaypoint != null) {
- final cgWaypoint waypoint = new cgWaypoint();
+ final cgWaypoint waypoint = new cgWaypoint(cache.getShortdesc(), convertWaypointSym2Type(sym));
waypoint.setId(-1);
- waypoint.setWaypointType(convertWaypointSym2Type(sym));
waypoint.setGeocode(cacheGeocodeForWaypoint);
waypoint.setPrefix(cache.getName().substring(0, 2));
waypoint.setLookup("---");
// there is no lookup code in gpx file
- waypoint.setName(cache.getShortdesc());
waypoint.setCoords(cache.getCoords());
waypoint.setNote(cache.getDescription());
- if (cacheForWaypoint.getWaypoints() == null) {
- cacheForWaypoint.setWaypoints(new ArrayList<cgWaypoint>());
- }
- cgWaypoint.mergeWayPoints(cacheForWaypoint.getWaypoints(), Collections.singletonList(waypoint), true);
+ ArrayList<cgWaypoint> mergedWayPoints = new ArrayList<cgWaypoint>();
+ mergedWayPoints.addAll(cacheForWaypoint.getWaypoints());
+
+ cgWaypoint.mergeWayPoints(mergedWayPoints, Collections.singletonList(waypoint), true);
+ cacheForWaypoint.setWaypoints(mergedWayPoints);
result.put(cacheGeocodeForWaypoint, cacheForWaypoint);
showProgressMessage(progressHandler, progressStream.getProgress());
}