aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authoramy <[email protected]>2025-12-01 02:29:08 -0800
committerGitHub <[email protected]>2025-12-01 02:29:08 -0800
commita7caf5e9f4ca1cfddafaf5880d7ee2020e3c1578 (patch)
tree86009cf7312ff6dc4cb5c2e1bcf7a9a43a561750 /src/util.c
parent228ba21e4fe702393b5e131ea14bbbfceff3f0b1 (diff)
parent735c7feb19cb29ec24588bf1a4986b52f8cf6ffa (diff)
Merge pull request #6 from ameliasquires/main
update
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index bcaff02..39f2569 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);
}
+