Update Server.zig

This commit is contained in:
nullptrdevs 2022-08-22 10:49:15 -07:00 committed by GitHub
parent 2c5ae262f7
commit 4d0ab8b1aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2442,7 +2442,7 @@ pub fn processJsonRpc(server: *Server, writer: anytype, json: []const u8) !void
[]const u8 => switch (value) { []const u8 => switch (value) {
.String => |s| blk: { .String => |s| blk: {
var nv = try server.allocator.dupe(u8, s); 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; break :blk nv;
}, // TODO: Allocation model? (same with didChangeConfiguration); imo this isn't *that* bad but still }, // TODO: Allocation model? (same with didChangeConfiguration); imo this isn't *that* bad but still
else => @panic("Invalid configuration value"), // TODO: Handle this else => @panic("Invalid configuration value"), // TODO: Handle this