Fix crash if a block has no stats
This commit is contained in:
parent
dd813aa624
commit
b7f725afee
@ -423,7 +423,7 @@ class Parser
|
||||
{
|
||||
stats.Add(ParseStat(tokens));
|
||||
}
|
||||
BlockNode ret = new(stats: stats, startRegion: startRegion, endRegion: stats[^1].endRegion);
|
||||
BlockNode ret = new(stats: stats, startRegion: startRegion, endRegion: (stats.Count == 0) ? startRegion : stats[^1].endRegion);
|
||||
if(index < tokens.Length && tokens[index].type == TokenType.Return)
|
||||
{
|
||||
ret.retstat = ParseRetstat(tokens);
|
||||
|
Loading…
x
Reference in New Issue
Block a user