From 20bd9521cd558e39eca4aac5f3db8e390f49ba2d Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Fri, 26 Jan 2024 13:55:33 -0800 Subject: Change README --- src/stem.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/stem.c') diff --git a/src/stem.c b/src/stem.c index f5a13ad..f623ae7 100644 --- a/src/stem.c +++ b/src/stem.c @@ -447,16 +447,22 @@ ht_t *init_ht(size_t size) { } void ht_add(ht_t *h, string_t *key, void *v, void (*freefunc)(void *)) { + if (key == NULL) + return; sll_add(h->buckets[hash(h, key->value)], key, v, freefunc); } void *ht_get(ht_t *h, string_t *key) { + if (key == NULL) + return NULL; return sll_get(h->buckets[hash(h, key->value)], key); } bool ht_exists(ht_t *h, string_t *key) { return ht_get(h, key) != NULL; } void ht_delete(ht_t *h, string_t *key, void (*freefunc)(void *)) { + if (key == NULL) + return; sll_delete(h->buckets[hash(h, key->value)], key, freefunc); } -- cgit