Skip to content

Commit

Permalink
panic when empty string passed as dest_rel_path to addInstallFileWithDir
Browse files Browse the repository at this point in the history
causes the creation of a file instead of the directory that's meant to
be created
  • Loading branch information
travv0 authored and andrewrk committed Oct 29, 2020
1 parent 2679345 commit f51ccf0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/std/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,9 @@ pub const Builder = struct {
install_dir: InstallDir,
dest_rel_path: []const u8,
) *InstallFileStep {
if (dest_rel_path.len == 0) {
panic("dest_rel_path must be non-empty", .{});
}
const install_step = self.allocator.create(InstallFileStep) catch unreachable;
install_step.* = InstallFileStep.init(self, src_path, install_dir, dest_rel_path);
return install_step;
Expand Down

0 comments on commit f51ccf0

Please sign in to comment.