added null check to destructors

This commit is contained in:
2025-11-09 03:37:17 +05:00
parent d6436d0833
commit 2c8e6fc601
2 changed files with 6 additions and 0 deletions

View File

@@ -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);
}