From eaf5c6f86f4eff371098e6152378249a0206ae2d Mon Sep 17 00:00:00 2001 From: Francis Bouvier Date: Wed, 9 Oct 2024 12:40:17 +0200 Subject: [PATCH] cdp: ensure method action is present Signed-off-by: Francis Bouvier --- src/cdp/cdp.zig | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/cdp/cdp.zig b/src/cdp/cdp.zig index 19d029bc..bd406254 100644 --- a/src/cdp/cdp.zig +++ b/src/cdp/cdp.zig @@ -102,16 +102,17 @@ pub fn do( return error.UnknonwDomain; // select corresponding domain + const action = iter.next() orelse return error.BadMethod; return switch (domain) { - .Browser => browser(alloc, id, iter.next().?, &scanner, ctx), - .Target => target(alloc, id, iter.next().?, &scanner, ctx), - .Page => page(alloc, id, iter.next().?, &scanner, ctx), - .Log => log(alloc, id, iter.next().?, &scanner, ctx), - .Runtime => runtime(alloc, id, iter.next().?, &scanner, s, ctx), - .Network => network(alloc, id, iter.next().?, &scanner, ctx), - .Emulation => emulation(alloc, id, iter.next().?, &scanner, ctx), - .Fetch => fetch(alloc, id, iter.next().?, &scanner, ctx), - .Performance => performance(alloc, id, iter.next().?, &scanner, ctx), + .Browser => browser(alloc, id, action, &scanner, ctx), + .Target => target(alloc, id, action, &scanner, ctx), + .Page => page(alloc, id, action, &scanner, ctx), + .Log => log(alloc, id, action, &scanner, ctx), + .Runtime => runtime(alloc, id, action, &scanner, s, ctx), + .Network => network(alloc, id, action, &scanner, ctx), + .Emulation => emulation(alloc, id, action, &scanner, ctx), + .Fetch => fetch(alloc, id, action, &scanner, ctx), + .Performance => performance(alloc, id, action, &scanner, ctx), }; }