diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-01-17 22:06:26 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-01-17 22:06:26 +0100 |
| commit | b9a26e88108d1926a9a40b9e41e5c06636614ce9 (patch) | |
| tree | 3561d9cdd1f21808bf7009800d0584b76177d3a9 /main/src | |
| parent | df70af017bd06a223b22197b65ae46eb37d48f26 (diff) | |
| parent | d8cca2b5580f57655c707c98680cf00677e78165 (diff) | |
| download | cgeo-b9a26e88108d1926a9a40b9e41e5c06636614ce9.zip cgeo-b9a26e88108d1926a9a40b9e41e5c06636614ce9.tar.gz cgeo-b9a26e88108d1926a9a40b9e41e5c06636614ce9.tar.bz2 | |
Merge branch 'release' into upstream
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/export/GpxSerializer.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/export/GpxSerializer.java b/main/src/cgeo/geocaching/export/GpxSerializer.java index ecc687f..2afed44 100644 --- a/main/src/cgeo/geocaching/export/GpxSerializer.java +++ b/main/src/cgeo/geocaching/export/GpxSerializer.java @@ -90,9 +90,14 @@ public final class GpxSerializer { private void exportBatch(final XmlSerializer gpx, Collection<String> geocodesOfBatch) throws IOException { final Set<Geocache> caches = DataStore.loadCaches(geocodesOfBatch, LoadFlags.LOAD_ALL_DB_ONLY); for (final Geocache cache : caches) { + final Geopoint coords = cache != null ? cache.getCoords() : null; + if (coords == null) { + // Export would be invalid without coordinates. + continue; + } gpx.startTag(PREFIX_GPX, "wpt"); - gpx.attribute("", "lat", Double.toString(cache.getCoords().getLatitude())); - gpx.attribute("", "lon", Double.toString(cache.getCoords().getLongitude())); + gpx.attribute("", "lat", Double.toString(coords.getLatitude())); + gpx.attribute("", "lon", Double.toString(coords.getLongitude())); final Date hiddenDate = cache.getHiddenDate(); if (hiddenDate != null) { |
