Skip to content

Commit

Permalink
Fixed Empty Option bug
Browse files Browse the repository at this point in the history
- Fixed an issue where getting an empty, unset Option would result in a null pointer panic.
  • Loading branch information
00JCIV00 committed Dec 13, 2024
1 parent a6a834c commit a576742
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Value.zig
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ pub fn Typed(comptime SetT: type, comptime config: Config) type {
/// This will pull the first value from `_set_args` and should be used with the `First` or `Last` Set Behaviors.
pub fn get(self: *const @This()) !ChildT {
return
if (self.is_set) self._set_args[0].?
if (self.is_set and !self.is_empty) self._set_args[0].?
else if (self.default_val) |def_val| def_val
else if (ChildT == bool) false
else error.ValueNotSet;
Expand Down

0 comments on commit a576742

Please sign in to comment.