codec/mjpeg/lex.go changed error checks for io.EOF to positive checks

This commit is contained in:
Saxon 2019-10-20 09:08:19 +10:30
parent 1c9146eec0
commit 7181532ccb
1 changed files with 6 additions and 6 deletions

View File

@ -63,10 +63,10 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
return nil
}
if err != nil {
if err != io.EOF {
return err
if err == io.EOF {
return nil
}
return nil
return err
}
if !bytes.Equal(buf, []byte{0xff, 0xd8}) {
return fmt.Errorf("parser: not MJPEG frame start: %#v", buf)
@ -75,10 +75,10 @@ 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 err
if err == io.EOF {
return nil
}
return nil
return err
}
buf = append(buf, b)
if last == 0xff && b == 0xd9 {