diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2015-04-28 21:04:50 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2015-04-28 21:04:50 +0200 |
commit | 1e41522dc8ae020c5b157b16aaeb86a174558886 (patch) | |
tree | 137dae34d114929456190f75fa6552c1bb149256 | |
parent | 9a262f37a252105e77760ea2e9415ad712e2da93 (diff) | |
download | cgeo-1e41522dc8ae020c5b157b16aaeb86a174558886.zip cgeo-1e41522dc8ae020c5b157b16aaeb86a174558886.tar.gz cgeo-1e41522dc8ae020c5b157b16aaeb86a174558886.tar.bz2 |
avoid NPE in GPX related tests
-rw-r--r-- | main/src/cgeo/geocaching/export/GpxExport.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java index c995c4f..b3996bb 100644 --- a/main/src/cgeo/geocaching/export/GpxExport.java +++ b/main/src/cgeo/geocaching/export/GpxExport.java @@ -41,7 +41,7 @@ import java.util.Locale; public class GpxExport extends AbstractExport { - private String fileName; + private String fileName = "geocache.gpx"; // used in tests public GpxExport() { super(R.string.export_gpx); @@ -49,8 +49,8 @@ public class GpxExport extends AbstractExport { @Override public void export(final List<Geocache> caches, final Activity activity) { - calculateFileName(caches); final String[] geocodes = getGeocodes(caches); + calculateFileName(geocodes); if (null == activity) { // No activity given, so no user interaction possible. // Start export with default parameters. @@ -62,10 +62,10 @@ public class GpxExport extends AbstractExport { } } - private void calculateFileName(final List<Geocache> caches) { - if (caches.size() == 1) { + private void calculateFileName(final String[] geocodes) { + if (geocodes.length == 1) { // geocode as file name - fileName = caches.get(0).getGeocode() + ".gpx"; + fileName = geocodes[0] + ".gpx"; } else { // date and time as file name |