Merge pull request #343 from leecannon/index_out_of_range

Fix index out of range
This commit is contained in:
Alexandros Naskos 2021-06-18 16:38:59 +03:00 committed by GitHub
commit 8319337db6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2296,7 +2296,11 @@ fn resolveUse(
defer _ = using_trail.pop(); defer _ = using_trail.pop();
for (uses) |use| { for (uses) |use| {
const expr = .{ .node = handle.tree.nodes.items(.data)[use.*].lhs, .handle = handle }; const index = use.*;
if (handle.tree.nodes.items(.data).len <= index) continue;
const expr = .{ .node = handle.tree.nodes.items(.data)[index].lhs, .handle = handle };
const expr_type_node = (try resolveTypeOfNode(store, arena, expr)) orelse const expr_type_node = (try resolveTypeOfNode(store, arena, expr)) orelse
continue; continue;