Skip to content

Commit b7b192f

Browse files
authored
harden telemetry shutdown (#524)
1 parent c6309cc commit b7b192f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/MapboxTelemetry.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,13 @@ private void shutdownTelemetry() {
598598
withShutDown = false;
599599
events.removeAllElements();
600600
context.stopService(new Intent(context, TelemetryService.class));
601-
locationEngine.removeLocationEngineListener(this);
602-
locationEngine.removeLocationUpdates();
601+
if (locationEngine == null) {
602+
Log.e(LOG_TAG, String.format(
603+
"Shutdown error: Location Engine instance wasn't set up (initialized: %b).", initialized));
604+
} else {
605+
locationEngine.removeLocationEngineListener(this);
606+
locationEngine.removeLocationUpdates();
607+
}
603608
if (timer != null) {
604609
timer.cancel();
605610
timer = null;

0 commit comments

Comments
 (0)