added null check to destructors
This commit is contained in:
parent
d6436d0833
commit
2c8e6fc601
@ -22,6 +22,9 @@ void HashMap_construct_size(HashMap_* ptr, u32 value_t_size, FreeFunction NULLAB
|
||||
}
|
||||
|
||||
void HashMap_destroy(HashMap_* ptr){
|
||||
if(!ptr)
|
||||
return;
|
||||
|
||||
for(u32 i = 0; i < ptr->height; i++){
|
||||
HashMapBucket* bu = &ptr->table[i];
|
||||
u32 len = List_len(&bu->key_hash_list, KeyHash);
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
#include "tlibc/string/StringBuilder.h"
|
||||
|
||||
void StringBuilder_destroy(StringBuilder* b){
|
||||
if(!b)
|
||||
return;
|
||||
|
||||
free(b->buffer.data);
|
||||
b->buffer = List_construct_size(NULL, 0, 0);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user