Skip to content

Commit

Permalink
fix invalid unwrap when failing to create build file (#1636)
Browse files Browse the repository at this point in the history
`getBuildFile` may return null when creating the build file failed.
  • Loading branch information
Techatrix authored Dec 1, 2023
1 parent 28efa6d commit c7e6adc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/DocumentStore.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ pub fn uriFromImportStr(self: *DocumentStore, allocator: std.mem.Allocator, hand
}
}
} else if (isBuildFile(handle.uri)) blk: {
const build_file = self.getBuildFile(handle.uri).?;
const build_file = self.getBuildFile(handle.uri) orelse break :blk;
const build_config = build_file.tryLockConfig() orelse break :blk;
defer build_file.unlockConfig();

Expand Down
2 changes: 1 addition & 1 deletion src/features/completions.zig
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ fn completeFileSystemStringLiteral(
}, {});
}
} else if (DocumentStore.isBuildFile(handle.uri)) blk: {
const build_file = store.getBuildFile(handle.uri).?;
const build_file = store.getBuildFile(handle.uri) orelse break :blk;
const build_config = build_file.tryLockConfig() orelse break :blk;
defer build_file.unlockConfig();

Expand Down

0 comments on commit c7e6adc

Please sign in to comment.