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

Fix a pattern-match failure when decoder is closed #62

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/hd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ let rec decode : decoder -> decode =
| false -> Angstrom.Unbuffered.Incomplete
in
let len = Ke.Rke.length decoder.queue in
let slice =
if len = 0 then Bigstringaf.empty
else List.hd (Ke.Rke.N.peek decoder.queue)
in
if len > 0 || decoder.closed then (
let[@warning "-8"] (slice :: _) = Ke.Rke.N.peek decoder.queue in
decoder.state <-
continue slice ~off:0 ~len:(Bigstringaf.length slice) more;
protect decoder)
Expand Down