Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: fix line skipping when key is empty #323

Merged
merged 2 commits into from May 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions ini_test.go
Expand Up @@ -445,6 +445,8 @@ BiomeRarityScale: 100

BiomeGroup(NormalBiomes, 3, 99, RoofedForestEnchanted, ForestSakura, FloatingJungle
BiomeGroup(IceBiomes, 4, 85, Ice Plains)

= RainForest
`))
require.NoError(t, err)
require.NotNil(t, f)
Expand Down
2 changes: 1 addition & 1 deletion parser.go
Expand Up @@ -161,7 +161,7 @@ func readKeyName(delimiters string, in []byte) (string, int, error) {
}

endIdx = strings.IndexAny(line, delimiters)
if endIdx < 0 {
if endIdx <= 0 {
return "", -1, ErrDelimiterNotFound{line}
unknwon marked this conversation as resolved.
Show resolved Hide resolved
}
return strings.TrimSpace(line[0:endIdx]), endIdx + 1, nil
Expand Down