aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/cgData.java4
-rw-r--r--tests/src/cgeo/geocaching/cgDataTest.java14
2 files changed, 15 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index 52f4c3b..5080274 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -3081,10 +3081,10 @@ public class cgData {
public Set<cgWaypoint> loadWaypoints(final Viewport viewport, boolean excludeMine, boolean excludeDisabled) {
final StringBuilder where = new StringBuilder(buildCoordinateWhere(dbTableWaypoints, viewport));
if (excludeMine) {
- where.append(" and ").append(dbTableCaches).append(".own == 0 and ").append(dbTableCaches).append(".found == 0 ");
+ where.append(" and ").append(dbTableCaches).append(".own == 0 and ").append(dbTableCaches).append(".found == 0");
}
if (excludeDisabled) {
- where.append(" and ").append(dbTableCaches).append(".disabled == 0 ");
+ where.append(" and ").append(dbTableCaches).append(".disabled == 0");
}
init();
diff --git a/tests/src/cgeo/geocaching/cgDataTest.java b/tests/src/cgeo/geocaching/cgDataTest.java
index 15634a2..15e3170 100644
--- a/tests/src/cgeo/geocaching/cgDataTest.java
+++ b/tests/src/cgeo/geocaching/cgDataTest.java
@@ -2,6 +2,8 @@ package cgeo.geocaching;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
+import cgeo.geocaching.geopoint.Geopoint;
+import cgeo.geocaching.geopoint.Viewport;
import android.test.ApplicationTestCase;
@@ -91,4 +93,14 @@ public class cgDataTest extends ApplicationTestCase<cgeoapplication> {
app.removeList(listId2);
}
}
-} \ No newline at end of file
+
+ // Check that queries don't throw an exception (see issue #1429).
+ public static void testLoadWaypoints() {
+ final Viewport viewport = new Viewport(new Geopoint(-1, -2), new Geopoint(3, 4));
+ final cgeoapplication app = cgeoapplication.getInstance();
+ app.getWaypointsInViewport(viewport, false, false);
+ app.getWaypointsInViewport(viewport, false, true);
+ app.getWaypointsInViewport(viewport, true, false);
+ app.getWaypointsInViewport(viewport, true, true);
+ }
+}