Fix analyze by intervals

This commit is contained in:
Vitaliy 2021-01-14 11:44:02 +02:00
parent 9c9b4ea6de
commit e77fc42e92

View file

@ -454,6 +454,12 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
} else if (buttonIndex == ANALYZE_BY_INTERVALS_BUTTON_INDEX) {
FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();
TrkSegment segment = gpxFile.getGeneralSegment();
if (segment == null) {
List<TrkSegment> segments = gpxFile.getNonEmptyTrkSegments(false);
if (!Algorithms.isEmpty(segments)) {
segment = segments.get(0);
}
}
GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT};
List<GpxDisplayItem> items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes));
if (segment != null && !Algorithms.isEmpty(items)) {