Browse Source

Fixed reloadpcdb (#7065)

Fixes #7063

Thanks to @kaninhot004
Lemongrass3110 2 years ago
parent
commit
17d6381901
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/common/database.hpp

+ 3 - 1
src/common/database.hpp

@@ -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);