From a57674275dd2a02723b919b938e22b77f1bdf3d7 Mon Sep 17 00:00:00 2001 From: 00JCIV00 Date: Thu, 12 Dec 2024 22:24:04 -0500 Subject: [PATCH] Fixed Empty Option bug - Fixed an issue where getting an empty, unset Option would result in a null pointer panic. --- src/Value.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Value.zig b/src/Value.zig index 29f8e1b..12517b3 100644 --- a/src/Value.zig +++ b/src/Value.zig @@ -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;