From f85ca3990c8ee3d70dccc0088b331dbb45afab05 Mon Sep 17 00:00:00 2001 From: Tomas Mizera Date: Mon, 25 Sep 2023 15:50:45 +0200 Subject: [PATCH] Check if locationManager is validbefore removing updates --- .../src/uk/co/lutraconsulting/PositionTrackingService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java b/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java index a0e777141..eb5bfb7b7 100644 --- a/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java +++ b/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java @@ -83,7 +83,10 @@ public IBinder onBind( Intent intent ) { @Override public void onDestroy() { - locationManager.removeUpdates(this); + + if (locationManager != null) { + locationManager.removeUpdates(this); + } // Close the FileOutputStream when the service is destroyed try {