aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cache.c b/cache.c
index df1b4a3..6736a01 100644
--- a/cache.c
+++ b/cache.c
@@ -61,8 +61,9 @@ static int open_slot(struct cache_slot *slot)
if (bufz)
bufkeylen = bufz - slot->buf;
- slot->match = bufkeylen == slot->keylen &&
- !memcmp(slot->key, slot->buf, bufkeylen + 1);
+ if (slot->key)
+ slot->match = bufkeylen == slot->keylen &&
+ !memcmp(slot->key, slot->buf, bufkeylen + 1);
return 0;
}