Changeset 15652 in josm


Ignore:
Timestamp:
2020-01-06T23:22:18+01:00 (3 months ago)
Author:
Don-vip
Message:

see #18494 - fix NPE when downloading GPX data by bounds and not by URL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java

    r15646 r15652  
    153153        private String getLayerName() {
    154154            // Extract .gpx filename from URL to set the new layer name
    155             final Matcher matcher = Pattern.compile(GpxUrlPattern.EXTERNAL_GPX_FILE.pattern()).matcher(url);
    156             final String newLayerName = matcher.matches() ? matcher.group(1) : null;
     155            final Matcher matcher = url != null ? Pattern.compile(GpxUrlPattern.EXTERNAL_GPX_FILE.pattern()).matcher(url) : null;
     156            final String newLayerName = matcher != null && matcher.matches() ? matcher.group(1) : null;
    157157            final String metadataName = rawData != null ? rawData.getString(GpxConstants.META_NAME) : null;
    158158            final String defaultName = tr("Downloaded GPX Data");
Note: See TracChangeset for help on using the changeset viewer.