From 6cad09ec9c801e90d41f53ebcd673ef89050cc86 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 11 Feb 2022 17:41:33 +0100 Subject: Check if file to read is really a file --- src/std/hash_map.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/std/hash_map.c') diff --git a/src/std/hash_map.c b/src/std/hash_map.c index b4bd4c1..4bf55c6 100644 --- a/src/std/hash_map.c +++ b/src/std/hash_map.c @@ -224,6 +224,9 @@ bool hash_map_get_ref(HashMap *self, BufferView key, void **value) { HashMapBucketNode *bucket_node; bucket_size = buffer_get_size(&self->buckets, HashMapBucket); + if(bucket_size == 0) + return bool_false; + hash = self->hash_func((const u8*)key.data, key.size); bucket_index = hash % bucket_size; -- cgit v1.2.3