Skip to content

Commit

Permalink
defensive programming. refs #14836
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 7, 2024
1 parent 70e5ed1 commit 7834fa0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/netbuild/NBAlgorithms_Ramps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ NBRampsComputer::buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDist
NBNode* rn = new NBNode(newNodeID, curr->getGeometry().positionAtOffset(rampLength - currLength));
nc.insert(rn);
std::string name = curr->getID();
ec.splitAt(dc, curr, rn, newEdgeID, curr->getID(), curr->getNumLanes() + toAdd, curr->getNumLanes());
if (!ec.splitAt(dc, curr, rn, newEdgeID, curr->getID(), curr->getNumLanes() + toAdd, curr->getNumLanes())) {
WRITE_WARNING("Could not build on-ramp for edge '" + curr->getID() + "' for unknown reason");
return;
}
//ec.retrieve(name)->invalidateConnections();
curr = ec.retrieve(newEdgeID);
incremented.insert(curr);
Expand Down Expand Up @@ -353,7 +356,10 @@ NBRampsComputer::buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDis
NBNode* rn = new NBNode(newNodeID, pos);
nc.insert(rn);
std::string name = curr->getID();
ec.splitAt(dc, curr, rn, curr->getID(), newEdgeID, curr->getNumLanes(), curr->getNumLanes() + toAdd);
if (!ec.splitAt(dc, curr, rn, curr->getID(), newEdgeID, curr->getNumLanes(), curr->getNumLanes() + toAdd)) {
WRITE_WARNING("Could not build off-ramp for edge '" + curr->getID() + "' for unknown reason");
return;
}
curr = ec.retrieve(newEdgeID);
incremented.insert(curr);
last = curr;
Expand Down

0 comments on commit 7834fa0

Please sign in to comment.