Skip to content

Commit

Permalink
Merge pull request #14 from Jblew/_jl_fix_sigsegv_on_entry_without_an…
Browse files Browse the repository at this point in the history
…y_fields

fix: SIGSEGV on empty fields, closes #13
  • Loading branch information
nickng authored Apr 25, 2022
2 parents 8943063 + e86f514 commit 61c36c5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 41 deletions.
2 changes: 1 addition & 1 deletion bibtex.y
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ tag : /* empty */ { }
| tBAREIDENT tEQUAL longstring { $$ = &bibTag{key: $1, val: $3} }
;

tags : tag { $$ = []*bibTag{$1} }
tags : tag { if $1 != nil { $$ = []*bibTag{$1}; } }
| tags tCOMMA tag { if $3 == nil { $$ = $1 } else { $$ = append($1, $3) } }
;

Expand Down
83 changes: 43 additions & 40 deletions bibtex.y.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions example/empty-fields.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@misc{noauthor_notitle_nodate,
}

0 comments on commit 61c36c5

Please sign in to comment.