Changeset 34485 in osm for applications/editors


Ignore:
Timestamp:
2018-08-15T19:10:19+02:00 (6 years ago)
Author:
donvip
Message:

fix #josm16543 - Fix crash when gpx contains multiple segments (patch by reubot)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/DirectDownload/src/org/openstreetmap/josm/plugins/directdownload/DirectDownload.java

    r34483 r34485  
    6060                    return;
    6161                }
     62                GpxData dataNew = new GpxData();
    6263
    6364                for (GpxTrack trk : data.getTracks()) {
    6465                    HashMap<String, Object> attrib = new HashMap<>(trk.getAttributes());
    6566                    if (!trk.getAttributes().containsKey(GpxConstants.GPX_NAME)) {
    66                         System.out.println(track.filename);
    6767                        attrib.put(GpxConstants.GPX_NAME, track.filename);
    6868                    }
    6969                    if (!trk.getAttributes().containsKey(GpxConstants.GPX_DESC)) {
    70                         System.out.println(track.description);
    7170                        attrib.put(GpxConstants.GPX_DESC, track.description);
    7271                    }
    7372                    // replace the existing trace in the unmodifiable tracks
    7473                    data.removeTrack(trk);
    75                     trk = new ImmutableGpxTrack(new ArrayList<>(trk.getSegments()), attrib);
    76                     data.addTrack(trk);
     74                    dataNew.addTrack(new ImmutableGpxTrack(new ArrayList<>(trk.getSegments()), attrib));
    7775                }
     76
     77                data = dataNew;
    7878
    7979                final GpxLayer gpxLayer = new GpxLayer(data, (track.filename + " " + track.description).trim());
Note: See TracChangeset for help on using the changeset viewer.