fix: matchArray should not return an error on match failure

This commit is contained in:
CJ van den Berg 2025-03-22 21:46:55 +01:00
parent 183248d7f2
commit b32ffa3a52
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -759,7 +759,11 @@ fn matchArrayMore(iter_: *[]const u8, n_: u64) Error!bool {
fn matchArray(iter_: *[]const u8, arr: anytype, info: anytype) Error!bool {
var iter = iter_.*;
var n = try decodeArrayHeader(&iter);
var n = decodeArrayHeader(&iter) catch |e| switch (e) {
error.InvalidArrayType => return false,
error.InvalidPIntType => return e,
error.TooShort => return e,
};
inline for (info.fields) |f| {
const value = @field(arr, f.name);
if (isMore(value))