Skip to content

Commit

Permalink
Fix OOB error with empty journal entries
Browse files Browse the repository at this point in the history
  • Loading branch information
thijzert committed May 15, 2019
1 parent 4084bba commit e104ca3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ func Deserialize(r io.Reader, c chan *Entry) error {
}

ent = &Entry{Date: t}
if line[len(dateFormat):len(dateFormat)+3] == " * " {
if len(line) > len(dateFormat)+3 && line[len(dateFormat):len(dateFormat)+3] == " * " {
ent.Starred = true
ent.Contents = line[len(dateFormat)+3:]
} else {
} else if len(line) > len(dateFormat)+1 {
ent.Contents = line[len(dateFormat)+1:]
}

Expand Down

0 comments on commit e104ca3

Please sign in to comment.