diff options
| author | iamcheeseman <[email protected]> | 2026-04-06 19:55:34 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-04-06 19:55:34 -0400 |
| commit | ae37828dbaec1748621173650cd8dfe62059565e (patch) | |
| tree | fd698611eaca63aa299da6723ace074ee88ff8bb /uscript | |
| parent | b09d74f16b7199f9adb35648c5cd88e3924883f0 (diff) | |
fix: crash on undefined variable usage
Diffstat (limited to 'uscript')
| -rw-r--r-- | uscript/parser.c | 3 |
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 ( |
