Skip to content

Commit 5b66095

Browse files
authored
Merge pull request #20 from fieldpapers/check-fieldpapers-response
Check fieldpapers response
2 parents 4187897 + 664d1c3 commit 5b66095

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/org/openstreetmap/josm/plugins/fieldpapers/FieldPapersAddLayerAction.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public void openUrl(String url) {
7070
// fetch metadata
7171
JsonObject metadata = getMetadata(url);
7272

73+
if (metadata == null || metadata.getJsonString("tilejson_url") == null) {
74+
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));
75+
return;
76+
}
77+
7378
String tileJsonUrl = metadata.getJsonString("tilejson_url").getString();
7479
String id = metadata.getJsonString("id").getString();
7580

@@ -86,7 +91,7 @@ public void openUrl(String url) {
8691
double east = bounds.getJsonNumber(2).doubleValue();
8792
double north = bounds.getJsonNumber(3).doubleValue();
8893

89-
// save this atlas as the
94+
// save this atlas ID as the last used atlas
9095
FieldPapersPlugin.LAST_USED_ID.put(id);
9196

9297
Bounds b = new Bounds(new LatLon(south, west), new LatLon(north, east));
@@ -96,7 +101,7 @@ public void openUrl(String url) {
96101

97102
} catch (IOException ex) {
98103
Logging.error(ex);
99-
JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information for the id \"{0}\" from fieldpapers.org", url));
104+
JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information for \"{0}\" from fieldpapers.org", url));
100105
}
101106
}
102107

0 commit comments

Comments
 (0)