[Glacier] Fix div0 bug when calling .Contains on empty hashmap.
This commit is contained in:
parent
46ae5de30a
commit
d9a936db09
|
@ -92,6 +92,9 @@ const V& HashMap<K, V, H>::at(const K& key) const {
|
||||||
|
|
||||||
template <typename K, typename V, class H>
|
template <typename K, typename V, class H>
|
||||||
bool HashMap<K, V, H>::Contains(const K& key) const {
|
bool HashMap<K, V, H>::Contains(const K& key) const {
|
||||||
|
if (data_.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
uint64_t hc = H()(key);
|
uint64_t hc = H()(key);
|
||||||
auto& ll = data_[hc % data_.size()];
|
auto& ll = data_[hc % data_.size()];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue