Add proper range check

Whoops
This commit is contained in:
Jonathan Hähne 2021-04-07 17:26:50 +02:00
parent 0b2d633e1e
commit bb493c037a

View File

@ -2877,7 +2877,10 @@ fn makeScopeInternal(
}; };
errdefer scope.decls.deinit(); errdefer scope.decls.deinit();
if (token_tags[catch_token + 1] == .pipe and token_tags[catch_token + 2] == .identifier) { if (token_tags.len > catch_token + 2 and
token_tags[catch_token + 1] == .pipe and
token_tags[catch_token + 2] == .identifier)
{
const name = tree.tokenSlice(catch_token + 2); const name = tree.tokenSlice(catch_token + 2);
try scope.decls.putNoClobber(name, .{ .ast_node = catch_expr }); try scope.decls.putNoClobber(name, .{ .ast_node = catch_expr });
} }