Skip to content

Commit

Permalink
Fix panic for invalid bool values
Browse files Browse the repository at this point in the history
Close #56
  • Loading branch information
sam701 committed Jan 27, 2025
1 parent 73b64a2 commit 38067ab
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,15 @@ pub fn Parser(comptime Iterator: type) type {
var lw = try arena_alloc.alloc(u8, opt_value.len);

lw = std.ascii.lowerString(lw, opt_value);
try opt.value_ref.put(lw, self.orig_allocator);
opt.value_ref.put(lw, self.orig_allocator) catch |err| {
self.error_data = ErrorData{ .invalid_value = .{
.entity_type = .option,
.entity_name = opt.long_name,
.provided_string = opt_value,
.value_type = opt.value_ref.value_data.type_name,
} };
return err;
};
return;
}

Expand Down

0 comments on commit 38067ab

Please sign in to comment.