From b7f725afee6d707276c5933077034b92fc9e2c50 Mon Sep 17 00:00:00 2001 From: 0x4261756D <38735823+0x4261756D@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:48:43 +0100 Subject: [PATCH] Fix crash if a block has no stats --- Parser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Parser.cs b/Parser.cs index 87c80bc..87aa632 100644 --- a/Parser.cs +++ b/Parser.cs @@ -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);