From: Jiri Vlasak Date: Thu, 20 Jun 2019 11:29:33 +0000 (+0200) Subject: Protect usage of `n` when it is `nullptr` X-Git-Tag: v0.7.0~6^2~9 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar.git/commitdiff_plain/c828fb6c04d760766c7a3668c57cf5bddadbda4c Protect usage of `n` when it is `nullptr` --- diff --git a/decision_control/slotplanner.cc b/decision_control/slotplanner.cc index 8ac19e8..3f903aa 100644 --- a/decision_control/slotplanner.cc +++ b/decision_control/slotplanner.cc @@ -827,14 +827,14 @@ struct SamplingInfo ParallelSlot::getSamplingInfo() { struct SamplingInfo si; RRTNode *n = this->getMidd(); + if (n == nullptr) + return si; BicycleCar *bc = new BicycleCar(n->x(), n->y(), n->h()); RRTNode *cc; if (this->slotSide() == LEFT) cc = bc->ccl(); else cc = bc->ccr(); - if (n == nullptr) - return si; if (this->slotType() == PARALLEL) { BicycleCar *nbc = bc->move(cc, this->slotHeading() - n->h()); si.x0 = nbc->x();