Skip to content

Commit 2e137d4

Browse files
committed
Fix crash when referencing undeclared arrays
When declaring a variable or constant referencing an address of an element of an undeclared array, the compiler crashed. Fixed.
1 parent b0866b3 commit 2e137d4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/functional/dim_test0.bas

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
DIM a AT @c(1, 5)
3+
DIM c(10, 10) as UBYTE
4+
5+
const q = @c(2, 3)
6+

zxbparser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,9 @@ def p_var_decl_at(p):
622622
"""
623623
p[0] = None
624624

625+
if p[2] is None or p[3] is None or p[5] is None:
626+
return
627+
625628
if len(p[2]) != 1:
626629
syntax_error(p.lineno(1),
627630
'Only one variable at a time can be declared this way')

0 commit comments

Comments
 (0)