From 4d0ab8b1aa4c66fd8a945a96d4cb6ded0c2b09b0 Mon Sep 17 00:00:00 2001 From: nullptrdevs <16590917+nullptrdevs@users.noreply.github.com> Date: Mon, 22 Aug 2022 10:49:15 -0700 Subject: [PATCH] Update Server.zig --- src/Server.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Server.zig b/src/Server.zig index e42348b..c38fe89 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -2442,7 +2442,7 @@ pub fn processJsonRpc(server: *Server, writer: anytype, json: []const u8) !void []const u8 => switch (value) { .String => |s| blk: { var nv = try server.allocator.dupe(u8, s); - server.allocator.free(@field(server.config, field.name).?); + if (@field(server.config, field.name)) |prev_val| server.allocator.free(prev_val); break :blk nv; }, // TODO: Allocation model? (same with didChangeConfiguration); imo this isn't *that* bad but still else => @panic("Invalid configuration value"), // TODO: Handle this