Merged in fix-mjpeg-lex (pull request #261)

codec/mjpeg/lex.go: returning nil error from Lex if we get io.EOF on reading bytes

Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
Saxon Milton 2019-10-20 02:24:45 +00:00
commit 38eed6bb2d
1 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,9 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
return nil
}
if err != nil {
if err == io.EOF {
return nil
}
return err
}
if !bytes.Equal(buf, []byte{0xff, 0xd8}) {
@ -72,6 +75,9 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
for {
b, err := r.ReadByte()
if err != nil {
if err == io.EOF {
return nil
}
return err
}
buf = append(buf, b)