diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2011-12-17 09:59:10 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2011-12-17 09:59:10 +0100 |
commit | f2e48d191a9c9a8c2dd5459b9fe2ab77079f8160 (patch) | |
tree | 48ab12e371f1749dd9152c94028e1a5160f42a53 | |
parent | 66b01e94a441252be4edea543bae39d1baaa6adc (diff) | |
download | cgeo-f2e48d191a9c9a8c2dd5459b9fe2ab77079f8160.zip cgeo-f2e48d191a9c9a8c2dd5459b9fe2ab77079f8160.tar.gz cgeo-f2e48d191a9c9a8c2dd5459b9fe2ab77079f8160.tar.bz2 |
fix #890: Non existing waypoint
-rw-r--r-- | main/src/cgeo/geocaching/cgWaypoint.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/main/src/cgeo/geocaching/cgWaypoint.java b/main/src/cgeo/geocaching/cgWaypoint.java index ba49a97..ac3b8c5 100644 --- a/main/src/cgeo/geocaching/cgWaypoint.java +++ b/main/src/cgeo/geocaching/cgWaypoint.java @@ -75,21 +75,23 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { // copy user modified details of the waypoints if (newPoints != null && oldPoints != null) { for (cgWaypoint old : oldPoints) { - boolean merged = false; - if (old != null && old.getName() != null && old.getName().length() > 0) { - for (cgWaypoint waypoint : newPoints) { - if (waypoint != null && waypoint.getName() != null) { - if (old.getName().equalsIgnoreCase(waypoint.getName())) { - waypoint.merge(old); - merged = true; - break; + if (old != null) { + boolean merged = false; + if (old.getName() != null && old.getName().length() > 0) { + for (cgWaypoint waypoint : newPoints) { + if (waypoint != null && waypoint.getName() != null) { + if (old.getName().equalsIgnoreCase(waypoint.getName())) { + waypoint.merge(old); + merged = true; + break; + } } } } - } - // user added waypoints should also be in the new list - if (!merged) { - newPoints.add(old); + // user added waypoints should also be in the new list + if (!merged && old.isUserDefined()) { + newPoints.add(old); + } } } } |