From 79b60e4853fe6dd01dfa20de0dd4d1f0248b4edc Mon Sep 17 00:00:00 2001 From: Jacob Signorovitch Date: Tue, 25 Feb 2025 07:52:02 -0500 Subject: [PATCH] Fixed name error handling. --- src/exec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/exec.c b/src/exec.c index 5ea5729..640ed77 100644 --- a/src/exec.c +++ b/src/exec.c @@ -65,14 +65,15 @@ AST* exec_call(AST* ast) { AST* fdef = exec_find(fname); + if (fdef == NULL) + return ast_init(AST_TYPE_EXC, ast_exc_data_init(strdup("No such function found."))); + switch (fdef->type) { case AST_TYPE_BIF: ASTBIFData* bifdata = fdef->data; return (*bifdata)(argc, argv); default: return ast_init(AST_TYPE_EXC, ast_exc_data_init("Good job")); } - - return ast_init(AST_TYPE_EXC, ast_exc_data_init(strdup("No such function found."))); } AST* exec_find(char* name) { @@ -84,7 +85,7 @@ AST* exec_find(char* name) { if (val != NULL) return val; } - return ast_init(AST_TYPE_EXC, ast_exc_data_init("Couln't find term.")); + return NULL; } AST* exec_vdef(AST* ast) {