diff --git a/app/src/main/java/org/y20k/trackbook/MainActivity.java b/app/src/main/java/org/y20k/trackbook/MainActivity.java index e75c892..1075e75 100755 --- a/app/src/main/java/org/y20k/trackbook/MainActivity.java +++ b/app/src/main/java/org/y20k/trackbook/MainActivity.java @@ -721,8 +721,10 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys { Toast.makeText(this, stringResource, Toast.LENGTH_LONG).show(); // vibrate 50 milliseconds Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); - v.vibrate(50); + if (v != null) { + v.vibrate(50); // v.vibrate(VibrationEffect.createOneShot(50, DEFAULT_AMPLITUDE)); // todo check if there is a support library vibrator + } } diff --git a/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java b/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java index 6d13f83..da4269a 100755 --- a/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java +++ b/app/src/main/java/org/y20k/trackbook/MainActivityTrackFragment.java @@ -362,7 +362,7 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O private void displayTrack() { GeoPoint position; - if (mTrack != null) { + if (mTrack != null && mTrack.getSize() > 0) { // set end of track as position Location lastLocation = mTrack.getWayPointLocation(mTrack.getSize() -1); position = new GeoPoint(lastLocation.getLatitude(), lastLocation.getLongitude());