diff --git a/src/search.h b/src/search.h index 99b6e3435..616bcc278 100644 --- a/src/search.h +++ b/src/search.h @@ -861,6 +861,9 @@ Dht::Search::insertNode(const Sp& snode, time_point now, const Blob& token nodes.pop_back(); if (removingNode) return false; + // For some reason if removindNode was false, iterator could be + // invalid. + n = nodes.end(); } } if (n == nodes.end() or not *n)