Changeset 9481 in josm for trunk/src


Ignore:
Timestamp:
2016-01-16T10:28:39+01:00 (4 years ago)
Author:
simon04
Message:

fix #12378 - NPE when converting data layer to gpx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r9461 r9481  
    746746            final GpxData data = toGpxData();
    747747            final GpxLayer gpxLayer = new GpxLayer(data, tr("Converted from: {0}", getName()));
    748             final String filename = getAssociatedFile().getName().replaceAll(Pattern.quote(".gpx.osm") + "$", "") + ".gpx";
    749             gpxLayer.setAssociatedFile(new File(getAssociatedFile().getParentFile(), filename));
     748            if (getAssociatedFile() != null) {
     749                final String filename = getAssociatedFile().getName().replaceAll(Pattern.quote(".gpx.osm") + "$", "") + ".gpx";
     750                gpxLayer.setAssociatedFile(new File(getAssociatedFile().getParentFile(), filename));
     751            }
    750752            Main.main.addLayer(gpxLayer);
    751753            if (Main.pref.getBoolean("marker.makeautomarkers", true) && !data.waypoints.isEmpty()) {
Note: See TracChangeset for help on using the changeset viewer.