From a9c56b1b1165487f73cb6f039a90aeb00afe3be0 Mon Sep 17 00:00:00 2001 From: dravenk Date: Mon, 19 Aug 2024 14:08:29 +0800 Subject: [PATCH] update --- src/url.zig | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/url.zig b/src/url.zig index 7895caf..3960854 100644 --- a/src/url.zig +++ b/src/url.zig @@ -59,12 +59,18 @@ pub fn parseQuery(uri_query: []const u8) StringHashMap([]const u8) { break; } var kv = std.mem.splitSequence(u8, pair.?, "="); - if (kv.index == null) { + if (kv.buffer.len == 0) { break; } - const key: []const u8 = kv.next().?; - const value: []const u8 = kv.next().?; - querymap.put(key, value) catch break; + const key = kv.next(); + if (key == null) { + break; + } + const value = kv.next(); + if (value == null) { + break; + } + querymap.put(key.?, value.?) catch break; } return querymap; }