diff --git a/src/main/java/at/ac/ait/matsim/drs/optimizer/DrsRequest.java b/src/main/java/at/ac/ait/matsim/drs/optimizer/DrsRequest.java index 2d01ff3..cfb2ea3 100644 --- a/src/main/java/at/ac/ait/matsim/drs/optimizer/DrsRequest.java +++ b/src/main/java/at/ac/ait/matsim/drs/optimizer/DrsRequest.java @@ -45,6 +45,7 @@ public abstract class DrsRequest implements Request { * leg or a drs leg accompanied by walk access and egress legs. * * @param drsNetwork must only consist of links accessible to the drsDriver mode + * @return null in case no useful request can be created */ public static DrsRequest create(Id id, RoutingModule driverRouter, Network drsNetwork, Person person, Trip trip) { diff --git a/src/main/java/at/ac/ait/matsim/drs/optimizer/RequestsCollector.java b/src/main/java/at/ac/ait/matsim/drs/optimizer/RequestsCollector.java index 6ee793e..49d4a32 100644 --- a/src/main/java/at/ac/ait/matsim/drs/optimizer/RequestsCollector.java +++ b/src/main/java/at/ac/ait/matsim/drs/optimizer/RequestsCollector.java @@ -63,6 +63,9 @@ public void collectRequests() { Id id = Id.create(++requestId, Request.class); DrsRequest request = DrsRequest.create(id, driverRouter, drsNetwork, person, trip); + if (request == null) { + continue; + } double distance = request.getNetworkRouteDistance(); if (request instanceof DrsDriverRequest) {