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

master
y20k 2017-01-17 13:35:19 +01:00
parent ce452905fe
commit 6f7f58fa23
1 changed files with 2 additions and 4 deletions

View File

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