[Glacier] Fix div0 bug when calling .Contains on empty hashmap.

This commit is contained in:
Drew Galbraith 2023-11-25 11:13:09 -08:00
parent 46ae5de30a
commit d9a936db09
1 changed files with 3 additions and 0 deletions

View File

@ -92,6 +92,9 @@ const V& HashMap<K, V, H>::at(const K& key) const {
template <typename K, typename V, class H>
bool HashMap<K, V, H>::Contains(const K& key) const {
if (data_.size() == 0) {
return false;
}
uint64_t hc = H()(key);
auto& ll = data_[hc % data_.size()];