Skip to content

Commit

Permalink
Fixed crash loading invalid person plans. Refs eclipse-sumo#6903
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed May 29, 2020
1 parent 3c5711b commit e8a0a9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/netedit/GNENetHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,10 @@ GNENetHelper::PathCalculator::calculatePath(const SUMOVehicleClass vClass, const
// declare a solution vector
std::vector<GNEEdge*> solution;
// calculate route depending of number of partial myEdges
if (partialEdges.size() == 1) {
if (partialEdges.size() == 0) {
// partial edges empty, then return a empty vector
return solution;
} if (partialEdges.size() == 1) {
// if there is only one partialEdges, route has only one edge
solution.push_back(partialEdges.front());
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/demand/GNEDemandElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ GNEDemandElement::calculatePersonPlanLaneStartEndPos(double& startLanePos, doubl
// obtain last allowed vehicle lane of previous person plan
const GNELane *lastAllowedLanePrevious = previousPersonPlan->getLastAllowedVehicleLane();
// check if both plans start in the same lane
if (getFirstAllowedVehicleLane() != lastAllowedLanePrevious) {
if (lastAllowedLanePrevious && (getFirstAllowedVehicleLane() != lastAllowedLanePrevious)) {
extraStartPosition = lastAllowedLanePrevious->getLaneShape().positionAtOffset(startLanePos);
}
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/demand/GNEWalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ GNEWalk::computePath() {
} else if (myTagProperty.getTag() == GNE_TAG_WALK_BUSSTOP_EDGE) {
edges.push_back(getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
edges.push_back(getParentEdges().back());
} else if (myTagProperty.getTag() == GNE_TAG_WALK_BUSSTOP_BUSSTOP) {
edges.push_back(getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
edges.push_back(getParentAdditionals().back()->getParentLanes().front()->getParentEdge());
} else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
edges = getParentEdges();
} else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
Expand Down

0 comments on commit e8a0a9b

Please sign in to comment.