urange: fix bug (seg fault) in getMeta
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Christian Zimmermann 2024-02-02 16:27:18 +01:00
parent 27466f6ef1
commit 190032729a

View file

@ -300,6 +300,7 @@ namespace CNORXZ
auto b = mSpace.begin(); auto b = mSpace.begin();
auto e = mSpace.end(); auto e = mSpace.end();
auto i = std::lower_bound(b, e, meta, std::less<MetaT>()); auto i = std::lower_bound(b, e, meta, std::less<MetaT>());
CXZ_ASSERT(i != e, "element with meta data = " << toString(meta) << " not in range"); // check this first, otherwise the next test may potentially result in a seg fault!
CXZ_ASSERT(*i == meta, "element with meta data = " << toString(meta) << " not in range"); CXZ_ASSERT(*i == meta, "element with meta data = " << toString(meta) << " not in range");
return i - b; return i - b;
} }