src/string.c

changeset 985
68754c7de906
parent 962
cd418898af5c
--- a/src/string.c	Thu Nov 07 20:22:56 2024 +0100
+++ b/src/string.c	Thu Nov 07 22:46:58 2024 +0100
@@ -65,6 +65,7 @@
 }
 
 void cx_strfree(cxmutstr *str) {
+    if (str == NULL) return;
     free(str->ptr);
     str->ptr = NULL;
     str->length = 0;
@@ -74,6 +75,7 @@
         const CxAllocator *alloc,
         cxmutstr *str
 ) {
+    if (str == NULL) return;
     cxFree(alloc, str->ptr);
     str->ptr = NULL;
     str->length = 0;

mercurial