fixed handling of errors from lex methods

This commit is contained in:
Saxon 2020-01-22 13:45:01 +10:30
parent 78484b5f5b
commit 9b8667e56c
2 changed files with 5 additions and 6 deletions

View File

@ -28,7 +28,6 @@ LICENSE
package h265
import (
"errors"
"io"
"testing"
)
@ -248,8 +247,8 @@ func TestLex(t *testing.T) {
r := &rtpReader{packets: test.packets}
d := &destination{}
err := NewLexer(test.donl).Lex(d, r, 0)
switch {
case err == nil || errors.Is(err, io.EOF): // Do nothing
switch err {
case nil, io.EOF: // Do nothing
default:
t.Fatalf("error lexing: %v\n", err)
}

View File

@ -849,9 +849,9 @@ func (r *Revid) Update(vars map[string]string) error {
func (r *Revid) processFrom(read io.Reader, delay time.Duration) {
err := r.lexTo(r.filters[0], read, delay)
r.cfg.Logger.Log(logger.Debug, pkg+"finished lexing")
switch {
case err == nil: // Do nothing.
case errors.Is(err, io.EOF): // TODO: handle this depending on loop mode.
switch err {
case nil: // Do nothing.
case io.EOF: // TODO: handle this depending on loop mode.
default:
r.err <- err
}