Skip to content
Snippets Groups Projects
Commit f9fff3f9 authored by Romain BERNARD's avatar Romain BERNARD
Browse files

null safety in change lists

parent 137d78b5
No related branches found
No related tags found
1 merge request!1Multimodal Insertion Heuristic prototype
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment