aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps
diff options
context:
space:
mode:
authorHeiko W. Rupp <hwr@pilhuhn.de>2012-09-09 22:44:38 +0200
committerHeiko W. Rupp <hwr@pilhuhn.de>2012-09-09 22:44:38 +0200
commit760a91b383d7e40f1990c8ba82b65d5d42cea179 (patch)
tree4ae6ee9248e7f13cac66581b697efaf65456acdb /main/src/cgeo/geocaching/apps
parent70bacd6a868db73d9a8cef23fe1885b5b147e991 (diff)
downloadcgeo-760a91b383d7e40f1990c8ba82b65d5d42cea179.zip
cgeo-760a91b383d7e40f1990c8ba82b65d5d42cea179.tar.gz
cgeo-760a91b383d7e40f1990c8ba82b65d5d42cea179.tar.bz2
Prevent a NPE if cache and waypoint are null.
Diffstat (limited to 'main/src/cgeo/geocaching/apps')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
index 7530422..f27b53c 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
@@ -30,6 +30,8 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat
}
protected static boolean hasStaticMap(cgWaypoint waypoint) {
+ if (waypoint==null)
+ return false;
String geocode = waypoint.getGeocode();
int id = waypoint.getId();
if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
@@ -40,11 +42,12 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat
protected static boolean invokeStaticMaps(final Activity activity, final cgCache cache, final cgWaypoint waypoint, final boolean download) {
final ILogable logable = cache != null && cache.getListId() != 0 ? cache : waypoint;
- final String geocode = StringUtils.upperCase(logable.getGeocode());
- if (geocode == null) {
+ // If the cache is not stored for offline, cache seems to be null and waypoint may be null too
+ if (logable==null || logable.getGeocode()==null ) {
ActivityMixin.showToast(activity, getString(R.string.err_detail_no_map_static));
return true;
}
+ final String geocode = StringUtils.upperCase(logable.getGeocode());
StaticMapsActivity.startActivity(activity, geocode, download, waypoint);
return true;