OeffiMapView: Fix NullPointerException.

This commit is contained in:
Andreas Schildbach 2018-11-18 16:57:12 +01:00
parent f8b7003f5e
commit aae9361743

View file

@ -613,9 +613,12 @@ public class OeffiMapView extends MapView {
// show at most 16 stations // show at most 16 stations
final List<GeoPoint> points = new LinkedList<>(); final List<GeoPoint> points = new LinkedList<>();
for (final Station station : stations) { for (final Station station : stations) {
points.add(new GeoPoint(station.location.getLatAsDouble(), station.location.getLonAsDouble())); final Location location = station.location;
if (points.size() >= 16) if (location.hasCoord()) {
break; points.add(new GeoPoint(location.getLatAsDouble(), location.getLonAsDouble()));
if (points.size() >= 16)
break;
}
} }
// make sure a minimum area is shown // make sure a minimum area is shown