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:
committed by
Andrew Kelley
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);
|
||||
|
||||
Reference in New Issue
Block a user