fix: don't fail to consume input iterator in cbor match more operations

This commit is contained in:
CJ van den Berg 2024-03-21 22:43:34 +01:00
parent 5bb05db166
commit d20e071a4d

View file

@ -606,7 +606,12 @@ fn matchArray(iter_: *[]const u8, arr: anytype, info: anytype) CborError!bool {
inline for (info.fields) |f| {
const value = @field(arr, f.name);
if (isMore(value))
return matchArrayMore(&iter, n);
if (try matchArrayMore(&iter, n)) {
iter_.* = iter;
return true;
} else {
return false;
};
if (n == 0) return false;
const matched = try matchValue(&iter, @field(arr, f.name));
if (!matched) return false;