From 01c3959cbb6dbe378c7ec6d5d079397fdc1296b7 Mon Sep 17 00:00:00 2001 From: amy Date: Tue, 11 Nov 2025 19:32:32 -0600 Subject: oops fix null dereference and stuff --- src/util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/util.c b/src/util.c index 5612638..3baabe6 100644 --- a/src/util.c +++ b/src/util.c @@ -13,8 +13,10 @@ int gen_parse(char* inp, int len, parray_t** _table){ for(int i = 0; i < len; i++){ if(state != 1 && inp[i] == ';'){ - parray_set(table, last->c, (void*)current); - str_free(last); + if(last != NULL){ + parray_set(table, last->c, (void*)current); + str_free(last); + } last = NULL; current = str_init(""); state = 0; @@ -67,3 +69,4 @@ void _p_fatal(const char* m, int line, const char* file, const char* function){ void p_error(const char* m){ fprintf(stderr, "%s[error]%s %s\n",color_red, color_reset, m); } + -- cgit v1.2.3