mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Bugfix: SensorHandler may receive a connectionLost from BluetoothDriver without being connected first.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package de.dennisguse.opentracks.sensors;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -18,6 +19,8 @@ import de.dennisguse.opentracks.settings.PreferencesUtils;
|
||||
|
||||
public abstract class SensorHandler<AggregatorInput, AggregatorOutput> implements DriverObserver<AggregatorInput> {
|
||||
|
||||
private static final String TAG = SensorHandler.class.getSimpleName();
|
||||
|
||||
private final SensorManager sensorManager;
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -107,6 +110,11 @@ public abstract class SensorHandler<AggregatorInput, AggregatorOutput> implement
|
||||
|
||||
@Override
|
||||
public void onConnectionLost() {
|
||||
if (SensorHandler.this.aggregator == null) {
|
||||
Log.d(TAG, "Connection lost, but where not connected.");
|
||||
return;
|
||||
}
|
||||
|
||||
SensorHandler.this.aggregator.resetAggregated();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user