mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
Fix index-of-out-bounds when no versions are found in the sdk lib dir
The current code wrongly assumes that versions[0] will always exist after the iterateAndFilterByVersion call.
This commit is contained in:
parent
45b62c4529
commit
65cad8ab13
@ -476,6 +476,7 @@ pub const Installation = struct {
|
||||
|
||||
var iterator = sdk_lib_dir.iterate();
|
||||
const versions = try iterateAndFilterByVersion(&iterator, allocator, prefix);
|
||||
if (versions.len == 0) return error.InstallationNotFound;
|
||||
defer {
|
||||
for (versions[1..]) |version| allocator.free(version);
|
||||
allocator.free(versions);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user