diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2015-03-16 10:42:26 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2015-03-16 10:42:26 +0100 |
commit | 1b6f0a05a2bd414d9adeeacf2f99f74a5f5711d9 (patch) | |
tree | a6c0ba63136f72bae574528f30d983e7181d6553 | |
parent | f6fa10e9f58daf309c7c2e8ee85e241250a73d52 (diff) | |
parent | 115ead693d71025fac61d9390fed00fe150b96b1 (diff) | |
download | cgeo-1b6f0a05a2bd414d9adeeacf2f99f74a5f5711d9.zip cgeo-1b6f0a05a2bd414d9adeeacf2f99f74a5f5711d9.tar.gz cgeo-1b6f0a05a2bd414d9adeeacf2f99f74a5f5711d9.tar.bz2 |
Merge branch 'issue-4686' into upstream
-rw-r--r-- | main/res/values/changelog_release.xml | 5 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/main/res/values/changelog_release.xml b/main/res/values/changelog_release.xml index df9cee0..bb395bc 100644 --- a/main/res/values/changelog_release.xml +++ b/main/res/values/changelog_release.xml @@ -2,12 +2,13 @@ <resources> <!-- changelog for the release branch --> <string name="changelog_release" translatable="false">\n - <b>Next bugfix release</b>\n + <b>2015.03.12:</b>\n + · Fix: Searches not returning coordinates for premium members\n · Fix: Images from short description not shown in image gallery\n · Fix: Smilies in waypoint descriptions not shown\n \n \n - <b>2015.02.23</b>\n + <b>2015.02.23:</b>\n · Fix: Home location not parsed correctly\n · Fix: Crash exporting GPX for lab caches\n · Fix: Crash restoring non-existing database backup\n diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index c2edf44..033196c 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1207,7 +1207,9 @@ public class Geocache implements IWaypoint { waypoint.setGeocode(geocode); if (waypoint.getId() < 0) { // this is a new waypoint - assignUniquePrefix(waypoint); + if (StringUtils.isBlank(waypoint.getPrefix())) { + assignUniquePrefix(waypoint); + } waypoints.add(waypoint); if (waypoint.isFinalWithCoords()) { finalDefined = true; @@ -1242,13 +1244,14 @@ public class Geocache implements IWaypoint { } for (int i = OWN_WP_PREFIX_OFFSET; i < 100; i++) { - final String prefixCandidate = StringUtils.leftPad(String.valueOf(i), 2, '0'); + final String prefixCandidate = String.valueOf(i); if (!assignedPrefixes.contains(prefixCandidate)) { waypoint.setPrefix(prefixCandidate); - break; + return; } } + throw new IllegalStateException("too many waypoints, unable to assign unique prefix"); } public boolean hasWaypoints() { |