Fix possible out of bound exception

This commit is contained in:
Victor Shcherb 2013-07-26 00:27:43 +02:00
parent 3eafed9622
commit a831a017a5

View file

@ -433,11 +433,12 @@ public class MapActivityActions implements DialogProvider {
TargetPointsHelper targets = getTargets();
String via = "";
List<String> names = targets.getIntermediatePointNames();
List<LatLon> points = targets.getIntermediatePoints();
if (names.size() == 0) {
return via;
}
for (int i = 0; i < names.size(); i++) {
via += "\n - " + getRoutePointDescription(targets.getIntermediatePoints().get(i), names.get(i));
for (int i = 0; i < points.size() ; i++) {
via += "\n - " + getRoutePointDescription(points.get(i), i >= names.size() ? "" :names.get(i));
}
return mapActivity.getString(R.string.route_via) + via;
}