mirror of
https://github.com/irmen/prog8.git
synced 2024-12-26 14:29:35 +00:00
fix occasional crash when indexing an undefined array variable
This commit is contained in:
parent
efd7d6f0c0
commit
d01a26ec61
@ -142,8 +142,8 @@ _after:
|
|||||||
val indexExpr = arrayIndexedExpression.indexer.indexExpr
|
val indexExpr = arrayIndexedExpression.indexer.indexExpr
|
||||||
val indexerDt = indexExpr.inferType(program)
|
val indexerDt = indexExpr.inferType(program)
|
||||||
if(indexerDt.isWords) {
|
if(indexerDt.isWords) {
|
||||||
val arrayVar = arrayIndexedExpression.arrayvar.targetVarDecl(program)!!
|
val arrayVar = arrayIndexedExpression.arrayvar.targetVarDecl(program)
|
||||||
if(arrayVar.datatype==DataType.UWORD) {
|
if(arrayVar!=null && arrayVar.datatype==DataType.UWORD) {
|
||||||
val add: Expression =
|
val add: Expression =
|
||||||
if(indexExpr.constValue(program)?.number==0.0)
|
if(indexExpr.constValue(program)?.number==0.0)
|
||||||
arrayIndexedExpression.arrayvar.copy()
|
arrayIndexedExpression.arrayvar.copy()
|
||||||
|
Loading…
Reference in New Issue
Block a user