From 4bec93fdef853cfa0f9bbe68f9c131ff82f539ab Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Thu, 4 Aug 2022 18:48:20 +0600 Subject: [PATCH] 5897-Fix_location_null_pointer_exception issue: https://gitlab.e.foundation/e/backlog/-/issues/5897 - fix constants debug flag for release build - add location null check before location.getAccuracy() call to handle NPE --- .../blisslauncher/features/weather/WeatherUpdateService.java | 2 +- .../java/foundation/e/blisslauncher/core/utils/Constants.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java b/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java index 1247940107..71d25641f2 100644 --- a/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java +++ b/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java @@ -321,7 +321,7 @@ public class WeatherUpdateService extends Service { }catch (SecurityException e){ e.printStackTrace(); } - if (D) Log.v(TAG, "Current location is " + location + ", accuracy: " + location.getAccuracy()); + if (D && location != null) Log.v(TAG, "Current location is " + location + ", accuracy: " + location.getAccuracy()); if (location != null && location.getAccuracy() > LOCATION_ACCURACY_THRESHOLD_METERS) { if (D) Log.d(TAG, "Ignoring inaccurate location"); diff --git a/app/src/main/java/foundation/e/blisslauncher/core/utils/Constants.java b/app/src/main/java/foundation/e/blisslauncher/core/utils/Constants.java index 8b69e9a66b..2f84a08e33 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/utils/Constants.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/utils/Constants.java @@ -15,12 +15,14 @@ */ package foundation.e.blisslauncher.core.utils; +import foundation.e.blisslauncher.BuildConfig; + /** * Created by falcon on 8/3/18. */ public class Constants { - public static final boolean DEBUG = true; + public static final boolean DEBUG = BuildConfig.DEBUG; public static final String PREF_NAME = "foundation.e.blisslauncher.prefs"; public static final String WEATHER_SOURCE = "weather_source"; -- GitLab