Add check for referencesToRoutes

This commit is contained in:
Chumva 2019-07-09 18:20:48 +03:00
parent b6a22a663d
commit f500c4597f
2 changed files with 5 additions and 1 deletions

View file

@ -32,6 +32,10 @@ public class TransportStop extends MapObject {
return referencesToRoutes != null && referencesToRoutes.length == 1 && referencesToRoutes[0] == DELETED_STOP;
}
public boolean hasReferencesToRoutes() {
return referencesToRoutes != null && referencesToRoutes.length > 0;
}
public void setDeleted() {
this.referencesToRoutes = new int[] { DELETED_STOP };
}

View file

@ -168,7 +168,7 @@ public class TransportStopController extends MenuController {
private void addTransportStopRoutes(List<TransportStop> stops, List<TransportStopRoute> routes, boolean useEnglishNames, TransportIndexRepository t) {
for (TransportStop tstop : stops) {
if (!tstop.isDeleted()) {
if (!tstop.isDeleted() && tstop.hasReferencesToRoutes()) {
addRoutes(routes, useEnglishNames, t, tstop, transportStop, (int) MapUtils.getDistance(tstop.getLocation(), transportStop.getLocation()));
}
}