Buggy code:
private CGeoMap . UsersTimer usersTimer = null ; private CGeoMap . LoadThread loadThread = null ; private CGeoMap . DownloadThread downloadThread = null ; private CGeoMap . DisplayThread displayThread = null ; private CGeoMap . UsersThread usersThread = null ; private CGeoMap . DisplayUsersThread displayUsersThread = null ; private CGeoMap . LoadDetails loadDetailsThread = null ; private volatile long loadThreadRun = 0L ; private volatile long usersThreadRun = 0L ; private volatile boolean downloaded = false ; private CachesOverlay overlayCaches = null ; private OtherCachersOverlay overlayOtherCachers = null ; private ScaleOverlay overlayScale = null ; private PositionOverlay overlayPosition = null ; private int cachesCnt = 0 ; private Map < Integer , Drawable > iconsCache = new HashMap < Integer , Drawable > ( ) ; private List < cgCache > caches = new ArrayList < cgCache > ( ) ; private List < cgUser > users = new ArrayList < cgUser > ( ) ; private List < cgCoord > coordinates = new ArrayList < cgCoord > ( ) ; private ProgressDialog waitDialog = null ; private int detailTotal = 0 ; private int detailProgress = 0 ; private Long detailProgressTime = 0L ; private ImageSwitcher myLocSwitch = null ; private boolean live = true ; private boolean liveChanged = false ; private boolean centered = false ; private boolean alreadyCentered = false ; private final Handler displayHandler = new Handler ( ) { @ Override public void handleMessage ( Message msg ) { } } ; private final Handler showProgressHandler = new Handler ( ) { @ Override public void handleMessage ( Message msg ) { } } ; private final Handler loadDetailsHandler = new Handler ( ) { @ Override public void handleMessage ( Message msg ) { } } ; private final Handler noMapTokenHandler = new Handler ( ) { @ Override public void handleMessage ( Message msg ) { } } ; private String mapTitle ; public CGeoMap ( MapActivityImpl activity ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public void onResume ( ) { } @ Override public void onStop ( ) { } @ Override public void onPause ( ) { } @ Override public void onDestroy ( ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } private void addMapViewMenuItems ( final Menu menu ) { } @ Override public boolean onPrepareOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { final int id = item . getItemId ( ) ; switch ( id ) { case CGeoMap . MENU_TRAIL_MODE : Settings . setMapTrail ( ( ! ( Settings . isMapTrail ( ) ) ) ) ; return true ; case CGeoMap . MENU_MAP_LIVE : Settings . setLiveMap ( ( ! ( Settings . isLiveMap ( ) ) ) ) ; liveChanged = true ; searchId = null ; searchIdIntent = null ; return true ; case CGeoMap . MENU_STORE_CACHES : if ( ( ( live ) && ( ! ( isLoading ( ) ) ) ) && ( CollectionUtils . isNotEmpty ( caches ) ) ) { final List < String > geocodes = new ArrayList < String > ( ) ; List < cgCache > cachesProtected = new ArrayList < cgCache > ( caches ) ; try { if ( ( cachesProtected . size ( ) ) > 0 ) { final GeoPointImpl mapCenter = mapView . getMapViewCenter ( ) ; final int mapCenterLat = mapCenter . getLatitudeE6 ( ) ; final int mapCenterLon = mapCenter . getLongitudeE6 ( ) ; final int mapSpanLat = mapView . getLatitudeSpan ( ) ; final int mapSpanLon = mapView . getLongitudeSpan ( ) ; for ( cgCache oneCache : cachesProtected ) { if ( ( oneCache != null ) && ( ( oneCache . coords ) != null ) ) { <START_BUG> if ( ( ! ( cgBase . isCacheInViewPort ( mapCenterLat , mapCenterLon , mapSpanLat , mapSpanLon , oneCache . coords ) ) ) && ( app . isOffline ( oneCache . geocode , null ) ) ) { <END_BUG> geocodes . add ( oneCache . geocode ) ; } } } } } catch ( Exception e ) { Log . e ( tag , ( "cgeomap.onOptionsItemSelected.#4:<seq2seq4repair_space>" + ( e . toString ( ) ) ) ) ; } detailTotal = geocodes . size ( ) ; detailProgress = 0 ; if ( ( detailTotal ) == 0 ) { ActivityMixin . showToast ( activity , res . getString ( warn_save_nothing ) ) ; return true ; } waitDialog = new ProgressDialog ( activity ) ; waitDialog . setProgressStyle ( STYLE_HORIZONTAL ) ; waitDialog . setCancelable ( true ) ; waitDialog . setMax ( detailTotal ) ; waitDialog . setOnCancelListener ( new DialogInterface . OnCancelListener ( ) { public void onCancel ( DialogInterface arg0 ) { try { if ( ( loadDetailsThread ) != null ) { loadDetailsThread . stopIt ( ) ; } if ( ( geo ) == null ) { geo = app . startGeo ( activity , geoUpdate , base , 0 , 0 ) ; } if ( ( Settings . isUseCompass ( ) ) && ( ( dir ) == null ) ) { dir = app . startDir ( activity , dirUpdate ) ; } } catch ( Exception e ) { Log . e ( tag , ( "cgeocaches.onPrepareOptionsMenu.onCancel:<seq2seq4repair_space>" + ( e . toString ( ) ) ) ) ; } } } ) ; Float etaTime = Float . valueOf ( ( ( ( detailTotal ) * ( ( float ) ( 7 ) ) ) // 60 ) ) ; if ( etaTime < 0.4 ) { waitDialog . setMessage ( ( ( ( res . getString ( caches_downloading ) ) + "<seq2seq4repair_space>" ) + ( res . getString ( caches_eta_ltm ) ) ) ) ; }

Fix:
if ( ( cgBase . isCacheInViewPort ( mapCenterLat , mapCenterLon , mapSpanLat , mapSpanLon , oneCache . coords ) ) && ( ! ( app . isOffline ( oneCache . geocode , null ) ) ) ) {