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