From 024ba8ee8fc91716bcf9ff326a927053b3da808f Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Mon, 14 Aug 2023 13:44:26 -0700 Subject: [PATCH] fix edge case on ec2 query --- src/main.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.zig b/src/main.zig index 4680f78..4ba3b24 100644 --- a/src/main.zig +++ b/src/main.zig @@ -202,6 +202,9 @@ pub fn main() anyerror!void { const more = try aws.Request(services.ec2.describe_instances) .call(.{ .next_token = next_token, .max_results = 6 }, options); defer more.deinit(); + // we could have exactly 6, which means we have a next token(?!) but not + // any actual additional data + if (more.response.reservations == null) break; std.log.info("reservation count: {d}", .{more.response.reservations.?.len}); var batch_items: usize = 0; for (more.response.reservations.?) |reservation| {