From b73535f62136eaeb61fe18b88e2c3f35a9ff185d Mon Sep 17 00:00:00 2001 From: Ashish Kumar Date: Sat, 4 Aug 2018 21:33:57 +0530 Subject: [PATCH] =?UTF-8?q?added=20null=20check=20before=20initialising=20?= =?UTF-8?q?LatLng=20after=20receiving=20location=20=E2=80=A6=20(#1791)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added null check before initialising LatLng after receiving location permission * flipped null==lastKL with lastKL==null --- .../fr/free/nrw/commons/location/LocationServiceManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java b/app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java index cd1082ba5..4a137beed 100644 --- a/app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java +++ b/app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java @@ -106,6 +106,9 @@ public class LocationServiceManager implements LocationListener { if (lastKL == null) { lastKL = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } + if (lastKL == null) { + return null; + } return LatLng.from(lastKL); } else { return null;