Skip to content

Commit

Permalink
Fix blank line detection in cache.db parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ejv2 committed Aug 8, 2024
1 parent 17916ca commit e4dbfcb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions data/cache-db.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,14 @@ func (c *CacheDB) Open() error {
}

elem := scanner.Text()
// Ignore comments
if strings.HasPrefix(elem, "#") {
// Ignore comments and blank lines
if len(elem) == 0 || strings.HasPrefix(elem, "#") {
continue
}

fields := strings.Fields(elem)

if len(fields) < 2 {
if len(fields) == 0 {
continue
}
return CacheSyntaxError{i, "insufficient fields (expect 2)"}
}

Expand Down

0 comments on commit e4dbfcb

Please sign in to comment.