Fix chart crash

This commit is contained in:
crimean 2019-04-18 10:37:24 +03:00
parent b1379d25a3
commit d05e6bcdee

View file

@ -27,7 +27,6 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SettingsNavigationActivity; import net.osmand.plus.activities.SettingsNavigationActivity;
import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.router.RouteStatistics;
import net.osmand.router.RouteStatistics.Boundaries; import net.osmand.router.RouteStatistics.Boundaries;
import net.osmand.router.RouteStatistics.RouteSegmentAttribute; import net.osmand.router.RouteStatistics.RouteSegmentAttribute;
import net.osmand.router.RouteStatistics.Statistics; import net.osmand.router.RouteStatistics.Statistics;
@ -83,7 +82,7 @@ public class RouteInfoCard extends BaseCard {
public void onValueSelected(Entry e, Highlight h) { public void onValueSelected(Entry e, Highlight h) {
List<RouteSegmentAttribute<E>> elems = routeStatistics.getElements(); List<RouteSegmentAttribute<E>> elems = routeStatistics.getElements();
int i = h.getStackIndex(); int i = h.getStackIndex();
if (elems.size() > i) { if (i >= 0 && elems.size() > i) {
selectedPropertyName = elems.get(i).getPropertyName(); selectedPropertyName = elems.get(i).getPropertyName();
if (showLegend) { if (showLegend) {
updateLegend(routeStatistics); updateLegend(routeStatistics);