diff --git a/Upsilon/Binder/Binder.cs b/Upsilon/Binder/Binder.cs index 90f6109..02e2a20 100644 --- a/Upsilon/Binder/Binder.cs +++ b/Upsilon/Binder/Binder.cs @@ -804,8 +804,12 @@ namespace Upsilon.Binder { var variable = (BoundVariableExpression)indexable.Identifier; var index = (BoundLiteralExpression)indexable.Index; - ((TableVariableSymbol)variable.Variable.VariableSymbol).Variables.Add(index.Value.ToString(), - new VariableSymbol(index.Value.ToString(), value.Type, false)); + var variableSymbol = variable.Variable.VariableSymbol; + if (variableSymbol is TableVariableSymbol tableVariableSymbol) + { + tableVariableSymbol.Variables.Add(index.Value.ToString(), + new VariableSymbol(index.Value.ToString(), value.Type, false)); + } } indexableExpression = indexable; }