Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merged in bugfix/crash_on_bad_dim (pull request boriel-basic#223)
Browse files Browse the repository at this point in the history
Fix crash when referencing undeclared arrays

Approved-by: Jose Rodriguez <boriel@gmail.com>
  • Loading branch information
boriel committed Oct 6, 2019
2 parents 7e732a5 + 8a82009 commit 3c2e340
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/functional/dim_test0.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

DIM a AT @c(1, 5)
DIM c(10, 10) as UBYTE

const q = @c(2, 3)

3 changes: 3 additions & 0 deletions zxbparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,9 @@ def p_var_decl_at(p):
"""
p[0] = None

if p[2] is None or p[3] is None or p[5] is None:
return

if len(p[2]) != 1:
syntax_error(p.lineno(1),
'Only one variable at a time can be declared this way')
Expand Down

0 comments on commit 3c2e340

Please sign in to comment.