summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uscript/parser.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/uscript/parser.c b/uscript/parser.c
index c51bc85..857fad3 100644
--- a/uscript/parser.c
+++ b/uscript/parser.c
@@ -170,6 +170,9 @@ void declare_variable(struct parser *p, struct token name)
static
int find_local(struct func_parser *fp, struct token name)
{
+ if (fp == NULL)
+ return -1;
+
for (int i = da_len(fp->locals) - 1; i >= 0; i--) {
struct variable local = fp->locals[i];
if (