Bugfix: prevent crash while stopping recording (race condition).

Part of #1328
This commit is contained in:
Dennis Guse
2022-10-27 19:31:50 +02:00
parent cacfcbd4d6
commit 8073f12947
@@ -267,10 +267,11 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
@Override
public void newGpsStatus(GpsStatusValue gpsStatusValue) {
notificationManager.updateContent(getString(gpsStatusValue.message));
//TODO This check should not be necessary, but prevents a crash; somehow the shutdown is not working correctly as we should not receive a notification then.
// It is likely a race condition as the LocationManager provides location updates without using the Handler.
if (gpsStatusObservable != null) {
notificationManager.updateContent(getString(gpsStatusValue.message));
gpsStatusObservable.postValue(gpsStatusValue);
}
}