diff --git a/src/datastructures.c b/src/datastructures.c
index 55b8345eb8854f483640e258f68000dc8b2444d0..075b966bc7c67d3fc266b2bce2938b64f78862b4 100644
--- a/src/datastructures.c
+++ b/src/datastructures.c
@@ -147,6 +147,8 @@ void* h_hashtable_get(const HHashTable* ht, const void* key) {
   for (hte = &ht->contents[hashval & (ht->capacity - 1)];
        hte != NULL;
        hte = hte->next) {
+    if (hte->key == NULL)
+      continue;
     if (hte->hashval != hashval)
       continue;
     if (ht->equalFunc(key, hte->key))