avoid panic if rest of line is all whitespace
All checks were successful
Generic zig build / build (push) Successful in 30s

This commit is contained in:
Emil Lerch 2026-09-02 13:09:45 -07:00
parent 4bec474f7a
commit e2b49957cd
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -331,7 +331,8 @@ pub const Value = union(enum) {
// be a comma. If in long mode, we could have whitespace + comment // be a comma. If in long mode, we could have whitespace + comment
var buf: [256]u8 = undefined; var buf: [256]u8 = undefined;
if (state.field_delimiter == '\n') { if (state.field_delimiter == '\n') {
if (std.mem.trimStart(u8, past_val, std.ascii.whitespace[0..])[0] != '#') { const rest = std.mem.trimStart(u8, past_val, std.ascii.whitespace[0..]);
if (rest.len > 0 and rest[0] != '#') {
const msg = std.fmt.bufPrint( const msg = std.fmt.bufPrint(
&buf, &buf,
"line has {} additional bytes after field value. Perhaps length should be restated as {}?", "line has {} additional bytes after field value. Perhaps length should be restated as {}?",