Fix bug in planner VaryMatchingStart iterator

Reviewers: teon.banek, florijan, buda

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D680
This commit is contained in:
Mislav Bradac 2017-08-18 16:01:53 +02:00
parent c7cb428eaf
commit 5a69f46f1f

View File

@ -208,7 +208,13 @@ class VaryMatchingStart {
if (*start_nodes_it_ == self_.nodes_.end()) { if (*start_nodes_it_ == self_.nodes_.end()) {
return *this; return *this;
} }
const auto &start_node = *(*start_nodes_it_)++; ++*start_nodes_it_;
// start_nodes_it_ can become equal to `end` and we shouldn't dereference
// iterator in that case.
if (*start_nodes_it_ == self_.nodes_.end()) {
return *this;
}
const auto &start_node = **start_nodes_it_;
current_matching_ = current_matching_ =
Matching{ExpansionsFrom(start_node, self_.matching_.expansions, Matching{ExpansionsFrom(start_node, self_.matching_.expansions,
self_.symbol_table_), self_.symbol_table_),