aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-06-05 00:34:25 +0200
committerSamuel Tardieu <sam@rfc1149.net>2012-06-05 00:34:25 +0200
commit752923ea4c8fb4d6b153ef9e3b24bf2d22fdb17c (patch)
tree6aafdcafb845ead76e36ec57ebc7471ff6912f63 /main/src/cgeo/geocaching
parent59114157275ecefbb04cedf64248af75eaff9fc5 (diff)
downloadcgeo-752923ea4c8fb4d6b153ef9e3b24bf2d22fdb17c.zip
cgeo-752923ea4c8fb4d6b153ef9e3b24bf2d22fdb17c.tar.gz
cgeo-752923ea4c8fb4d6b153ef9e3b24bf2d22fdb17c.tar.bz2
Prevent NPE by checking for null coordinates
The bug was reported several times through the Google Play console.
Diffstat (limited to 'main/src/cgeo/geocaching')
-rw-r--r--main/src/cgeo/geocaching/CacheCache.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/CacheCache.java b/main/src/cgeo/geocaching/CacheCache.java
index 877c960..e027a8a 100644
--- a/main/src/cgeo/geocaching/CacheCache.java
+++ b/main/src/cgeo/geocaching/CacheCache.java
@@ -102,8 +102,12 @@ public class CacheCache {
private static class CacheRemoveHandler implements RemoveHandler<cgCache> {
@Override
- public void onRemove(cgCache removed) {
- Tile.Cache.removeFromTileCache(removed);
+ public void onRemove(final cgCache removed) {
+ // FIXME: as above, we sometimes get caches with null coordinates, that may then provoke
+ // a NullPointerException down the invocation chain.
+ if (removed.getCoords() != null) {
+ Tile.Cache.removeFromTileCache(removed);
+ }
}
}