From 285d3c1a6c60f8b274008e66a53823ed16413cdb Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Fri, 25 May 2018 15:43:36 +0300 Subject: [PATCH] Replace cached location with current --- OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java index 16f2538a1f..69394cb8fe 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java @@ -874,8 +874,7 @@ public class OsmAndLocationProvider implements SensorEventListener { if (loc != null) { int counter = locationRequestsCounter.incrementAndGet(); if (counter >= REQUESTS_BEFORE_CHECK_LOCATION && locationRequestsCounter.compareAndSet(counter, 0)) { - net.osmand.Location cached = cachedLocation; - if (cached != null && System.currentTimeMillis() - cached.getTime() > LOCATION_TIMEOUT_TO_BE_STALE) { + if (System.currentTimeMillis() - loc.getTime() > LOCATION_TIMEOUT_TO_BE_STALE) { location = null; } }