Fixed reloadpcdb (#7065)

Fixes #7063

Thanks to @kaninhot004
This commit is contained in:
Lemongrass3110 2022-06-26 14:16:46 +02:00 committed by GitHub
parent 5e6fd03848
commit 17d6381901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,8 +183,10 @@ public:
// Check if the key fits into the current cache size
if (this->cache.capacity() <= key) {
// Some keys compute to 0, so we allocate a minimum of 500 (250*2) entries
const static size_t minimum = 250;
// Double the current size, so we do not have to resize that often
size_t new_size = key * 2;
size_t new_size = std::max( key, minimum ) * 2;
// Very important => initialize everything to nullptr
this->cache.resize(new_size, nullptr);