make sure collapse only happens on valid indices

This commit is contained in:
Moritz Kobitzsch 2016-09-05 12:41:33 +02:00
parent 7528b27f99
commit 47a6cd5462

View File

@ -832,8 +832,8 @@ std::vector<RouteStep> collapseTurns(std::vector<RouteStep> steps)
invalidateStep(steps[step_index]); invalidateStep(steps[step_index]);
invalidateStep(steps[next_step_index]); invalidateStep(steps[next_step_index]);
} }
else if (choiceless(current_step, one_back_step) || else if (one_back_index > 0 && (choiceless(current_step, one_back_step) ||
one_back_step.distance <= MAX_COLLAPSE_DISTANCE) one_back_step.distance <= MAX_COLLAPSE_DISTANCE))
{ {
// check for one of the multiple collapse scenarios and, if possible, collapse the // check for one of the multiple collapse scenarios and, if possible, collapse the
// turn // turn