diff --git a/src/routes/vehicle/propagation/SAEVRouteChangelist.cpp b/src/routes/vehicle/propagation/SAEVRouteChangelist.cpp index d2e08853d6e177aefad58245bd92d985fddea415..535941b00f08845bf95b8d8489224d653a899d8d 100644 --- a/src/routes/vehicle/propagation/SAEVRouteChangelist.cpp +++ b/src/routes/vehicle/propagation/SAEVRouteChangelist.cpp @@ -21,7 +21,8 @@ void SAEVRouteChangelist::emplace_back(SAEVKeyPoint &kp, Bound bound, uint value } void SAEVRouteChangelist::applyChanges() { - if(_status < InsertionStatus::FAILURE_PRECONDITION_TW) { + if(_requestOriginKeyPoint != nullptr && _originPredecessorKP != nullptr + && _destinationPredecessorKP != nullptr && _status < InsertionStatus::FAILURE_PRECONDITION_TW) { _routePtr->insertRequest(*_requestOriginKeyPoint, _originPredecessorKP, _destinationPredecessorKP); } for(SAEVRouteChange change : _changelist) { @@ -31,7 +32,8 @@ void SAEVRouteChangelist::applyChanges() { } void SAEVRouteChangelist::revertChanges() { - if(_status < InsertionStatus::FAILURE_PRECONDITION_TW) { + if(_requestOriginKeyPoint != nullptr && _originPredecessorKP != nullptr + && _destinationPredecessorKP != nullptr && _status < InsertionStatus::FAILURE_PRECONDITION_TW) { _routePtr->removeRequest(*_requestOriginKeyPoint); } for(SAEVRouteChange change : _changelist) {