Merge pull request #5891 from mloskot/ml/check-indexed-data-for-empty-values

Avoid dereferencing iterators over empty indexed data values
This commit is contained in:
Denis Chapligin 2020-12-01 15:26:58 +02:00 committed by GitHub
commit 18a0f6c1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,6 +329,9 @@ template <typename GroupBlockPolicy, storage::Ownership Ownership> struct Indexe
// Return value at the given index
ResultType at(std::uint32_t index) const
{
if (values.empty())
return ResultType();
// Get block external ad internal indices
const BlocksNumberType block_idx = index / (BLOCK_SIZE + 1);
const std::uint32_t internal_idx = index % (BLOCK_SIZE + 1);