diff --git a/src/org/openstreetmap/josm/plugins/fieldpapers/FieldPapersAddLayerAction.java b/src/org/openstreetmap/josm/plugins/fieldpapers/FieldPapersAddLayerAction.java index 499d935..ef8a717 100644 --- a/src/org/openstreetmap/josm/plugins/fieldpapers/FieldPapersAddLayerAction.java +++ b/src/org/openstreetmap/josm/plugins/fieldpapers/FieldPapersAddLayerAction.java @@ -70,6 +70,11 @@ public void openUrl(String url) { // fetch metadata JsonObject metadata = getMetadata(url); + if (metadata == null || metadata.getJsonString("tilejson_url") == null) { + JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information from fieldpapers.org. Make sure you're using the URL for a Snapshot, not Atlas.", url)); + return; + } + String tileJsonUrl = metadata.getJsonString("tilejson_url").getString(); String id = metadata.getJsonString("id").getString(); @@ -86,7 +91,7 @@ public void openUrl(String url) { double east = bounds.getJsonNumber(2).doubleValue(); double north = bounds.getJsonNumber(3).doubleValue(); - // save this atlas as the + // save this atlas ID as the last used atlas FieldPapersPlugin.LAST_USED_ID.put(id); Bounds b = new Bounds(new LatLon(south, west), new LatLon(north, east)); @@ -96,7 +101,7 @@ public void openUrl(String url) { } catch (IOException ex) { Logging.error(ex); - JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information for the id \"{0}\" from fieldpapers.org", url)); + JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information for \"{0}\" from fieldpapers.org", url)); } }