1
0
Fork 0

Fixed undefined behaviour on Mac. An empty vector was popped.

This commit is contained in:
Michael Hackstein 2016-09-12 16:45:29 +02:00
parent b686f23cb9
commit 8d48ceca36
1 changed files with 10 additions and 2 deletions

View File

@ -53,6 +53,7 @@ bool DepthFirstEnumerator::next() {
_edgeCursors.emplace(cursor); _edgeCursors.emplace(cursor);
} }
} else { } else {
TRI_ASSERT(!_enumeratedPath.edges.empty());
// This path is at the end. cut the last step // This path is at the end. cut the last step
_enumeratedPath.vertices.pop_back(); _enumeratedPath.vertices.pop_back();
_enumeratedPath.edges.pop_back(); _enumeratedPath.edges.pop_back();
@ -70,6 +71,7 @@ bool DepthFirstEnumerator::next() {
_returnedEdges.emplace(_enumeratedPath.edges.back()); _returnedEdges.emplace(_enumeratedPath.edges.back());
} else { } else {
_traverser->_filteredPaths++; _traverser->_filteredPaths++;
TRI_ASSERT(!_enumeratedPath.edges.empty());
_enumeratedPath.edges.pop_back(); _enumeratedPath.edges.pop_back();
continue; continue;
} }
@ -79,6 +81,7 @@ bool DepthFirstEnumerator::next() {
_enumeratedPath.edges.size() - 1, _enumeratedPath.edges.size() - 1,
cursorId)) { cursorId)) {
// This edge does not pass the filtering // This edge does not pass the filtering
TRI_ASSERT(!_enumeratedPath.edges.empty());
_enumeratedPath.edges.pop_back(); _enumeratedPath.edges.pop_back();
continue; continue;
} }
@ -98,6 +101,7 @@ bool DepthFirstEnumerator::next() {
if (!foundOnce) { if (!foundOnce) {
// We found it and it was not the last element (expected) // We found it and it was not the last element (expected)
// This edge is allready on the path // This edge is allready on the path
TRI_ASSERT(!_enumeratedPath.edges.empty());
_enumeratedPath.edges.pop_back(); _enumeratedPath.edges.pop_back();
continue; continue;
} }
@ -123,6 +127,7 @@ bool DepthFirstEnumerator::next() {
if (!foundOnce) { if (!foundOnce) {
// We found it and it was not the last element (expected) // We found it and it was not the last element (expected)
// This vertex is allready on the path // This vertex is allready on the path
TRI_ASSERT(!_enumeratedPath.edges.empty());
_enumeratedPath.vertices.pop_back(); _enumeratedPath.vertices.pop_back();
_enumeratedPath.edges.pop_back(); _enumeratedPath.edges.pop_back();
continue; continue;
@ -136,13 +141,16 @@ bool DepthFirstEnumerator::next() {
return true; return true;
} }
// Vertex Invalid. Revoke edge // Vertex Invalid. Revoke edge
TRI_ASSERT(!_enumeratedPath.edges.empty());
_enumeratedPath.edges.pop_back(); _enumeratedPath.edges.pop_back();
continue; continue;
} else { } else {
// cursor is empty. // cursor is empty.
_edgeCursors.pop(); _edgeCursors.pop();
_enumeratedPath.edges.pop_back(); if (!_enumeratedPath.edges.empty()) {
_enumeratedPath.vertices.pop_back(); _enumeratedPath.edges.pop_back();
_enumeratedPath.vertices.pop_back();
}
} }
} }
if (_edgeCursors.empty()) { if (_edgeCursors.empty()) {