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