checks for mTrack == null in the method handling my location press - keeping better track of recording state

This commit is contained in:
y20k 2017-01-17 13:35:19 +01:00
parent ce452905fe
commit 6f7f58fa23

View file

@ -314,7 +314,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
// get current position // get current position
GeoPoint position; GeoPoint position;
if (mTrackerServiceRunning) { if (mTrackerServiceRunning && mTrack != null) {
// get current Location from tracker service // get current Location from tracker service
mCurrentBestLocation = mTrack.getWayPointLocation(mTrack.getSize() - 1); mCurrentBestLocation = mTrack.getWayPointLocation(mTrack.getSize() - 1);
} else if (mCurrentBestLocation == null) { } else if (mCurrentBestLocation == null) {
@ -652,9 +652,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
private void loadTrackerServiceState(Context context) { private void loadTrackerServiceState(Context context) {
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
int fabState = settings.getInt(PREFS_FAB_STATE, FAB_STATE_DEFAULT); int fabState = settings.getInt(PREFS_FAB_STATE, FAB_STATE_DEFAULT);
if (fabState == FAB_STATE_RECORDING) { mTrackerServiceRunning = fabState == FAB_STATE_RECORDING;
mTrackerServiceRunning = true;
}
} }