Fix possible NPE
This commit is contained in:
parent
d1694bf08c
commit
84a2f5f923
1 changed files with 3 additions and 3 deletions
|
@ -43,14 +43,14 @@ public class TransportRoute extends MapObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Way> getForwardWays() {
|
public List<Way> getForwardWays() {
|
||||||
return forwardWays;
|
return forwardWays == null ? Collections.emptyList() : forwardWays;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void mergeForwardWays() {
|
public void mergeForwardWays() {
|
||||||
boolean changed = true;
|
boolean changed = true;
|
||||||
// combine as many ways as possible
|
// combine as many ways as possible
|
||||||
while (changed) {
|
while (changed && forwardWays != null) {
|
||||||
changed = false;
|
changed = false;
|
||||||
for(int k = 0; k < forwardWays.size(); ) {
|
for(int k = 0; k < forwardWays.size(); ) {
|
||||||
// scan to merge with the next segment
|
// scan to merge with the next segment
|
||||||
|
@ -113,7 +113,7 @@ public class TransportRoute extends MapObject {
|
||||||
if (forwardStops.size() > 0) {
|
if (forwardStops.size() > 0) {
|
||||||
// resort ways to stops order
|
// resort ways to stops order
|
||||||
final Map<Way, int[]> orderWays = new HashMap<Way, int[]>();
|
final Map<Way, int[]> orderWays = new HashMap<Way, int[]>();
|
||||||
for (Way w : forwardWays) {
|
for (Way w : getForwardWays()) {
|
||||||
int[] pair = new int[] { 0, 0 };
|
int[] pair = new int[] { 0, 0 };
|
||||||
Node firstNode = w.getFirstNode();
|
Node firstNode = w.getFirstNode();
|
||||||
TransportStop st = forwardStops.get(0);
|
TransportStop st = forwardStops.get(0);
|
||||||
|
|
Loading…
Reference in a new issue