diff options
-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() { |