don't call compare function on NULL hashtable keys
This commit is contained in:
parent
6f44ab1196
commit
bfc2433320
1 changed files with 2 additions and 0 deletions
|
|
@ -147,6 +147,8 @@ void* h_hashtable_get(const HHashTable* ht, const void* key) {
|
||||||
for (hte = &ht->contents[hashval & (ht->capacity - 1)];
|
for (hte = &ht->contents[hashval & (ht->capacity - 1)];
|
||||||
hte != NULL;
|
hte != NULL;
|
||||||
hte = hte->next) {
|
hte = hte->next) {
|
||||||
|
if (hte->key == NULL)
|
||||||
|
continue;
|
||||||
if (hte->hashval != hashval)
|
if (hte->hashval != hashval)
|
||||||
continue;
|
continue;
|
||||||
if (ht->equalFunc(key, hte->key))
|
if (ht->equalFunc(key, hte->key))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue