Fixed segfault on spacey input.

This commit is contained in:
Jacob Signorovitch 2025-05-31 18:25:11 -04:00
parent 90c8c91410
commit a4afd3b58a
2 changed files with 6 additions and 1 deletions

View File

@ -88,7 +88,10 @@ void ast_destroy_psv(AST* ast) {
free(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) { void ast_print_i(AST* ast, int i) {
INDENT_BEGIN(i); INDENT_BEGIN(i);

View File

@ -13,6 +13,8 @@
AST* exec_start(AST* ast) { AST* exec_start(AST* ast) {
log_dbg("Started execution."); log_dbg("Started execution.");
if (!ast) return ast;
Scope* global = scope_init(NULL); Scope* global = scope_init(NULL);
global->uses = 1; global->uses = 1;