don't call compare function on NULL hashtable keys

This commit is contained in:
Sven M. Hallberg 2013-06-14 17:07:56 +02:00
parent 6f44ab1196
commit bfc2433320

View file

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