NodeCache: handle end() lower_bound for non-empty map

This commit is contained in:
Adrien Béraud committed 2017-10-15 15:57:14 +02:00
1 parent 9d4e6e0984
commit be2b9fd7dc
1 file changed
+1 -1
+1 -1
View File
@@ -48,7 +48,7 @@ NodeCache::getCachedNodes(const InfoHash& id, sa_family_t sa_f, size_t count) co
auto it_p = c.lower_bound(id),
it_n = it_p;
if (it_p != c.cend())
if (not c.empty())
dec_it(it_p); /* Create 2 separate iterator if we could */
while (nodes.size() < count and (it_n != c.cend() or it_p != c.cend())) {