From a4afd3b58a977140feba86f3527c7d7e646d28ec Mon Sep 17 00:00:00 2001 From: Jacob Date: Sat, 31 May 2025 18:25:11 -0400 Subject: [PATCH] Fixed segfault on spacey input. --- src/ast.c | 5 ++++- src/exec.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ast.c b/src/ast.c index f8b72fb..8e63437 100644 --- a/src/ast.c +++ b/src/ast.c @@ -88,7 +88,10 @@ void ast_destroy_psv(AST* ast) { free(ast); } -void ast_print(AST* ast) { ast_print_i(ast, 0); } +void ast_print(AST* ast) { + if (!ast) return; + ast_print_i(ast, 0); +} void ast_print_i(AST* ast, int i) { INDENT_BEGIN(i); diff --git a/src/exec.c b/src/exec.c index cb51c49..33611c0 100644 --- a/src/exec.c +++ b/src/exec.c @@ -13,6 +13,8 @@ AST* exec_start(AST* ast) { log_dbg("Started execution."); + if (!ast) return ast; + Scope* global = scope_init(NULL); global->uses = 1;