fix: extractAlloc should correctly handle optional values that are null
This commit is contained in:
parent
1ddcaf5e9e
commit
5b856423d1
1 changed files with 4 additions and 0 deletions
|
|
@ -1173,6 +1173,10 @@ fn GenericExtractorAlloc(T: type) type {
|
||||||
else => extractError(T),
|
else => extractError(T),
|
||||||
},
|
},
|
||||||
.optional => |opt_info| {
|
.optional => |opt_info| {
|
||||||
|
if (try matchNull(iter)) {
|
||||||
|
self.dest.* = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
var nested: opt_info.child = undefined;
|
var nested: opt_info.child = undefined;
|
||||||
const extractor = GenericExtractorAlloc(opt_info.child).init(&nested, self.allocator);
|
const extractor = GenericExtractorAlloc(opt_info.child).init(&nested, self.allocator);
|
||||||
if (try extractor.extract(iter)) {
|
if (try extractor.extract(iter)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue