codec/mjpeg/jpeg.go: simplified if statement

This commit is contained in:
Saxon 2020-01-02 15:04:16 +10:30
parent 31902f2448
commit 5a09a5f12d
1 changed files with 3 additions and 5 deletions

View File

@ -224,12 +224,10 @@ func (c *Context) ParsePayload(p []byte, m bool) error {
if qLen > 0 {
qTable = b.getBuf(qLen)
if q < 255 {
if c.qTablesLen[q-128] == 0 && qLen <= 128 {
if q < 255 && c.qTablesLen[q-128] == 0 && qLen <= 128 {
copy(c.qTables[q-128][:], qTable)
c.qTablesLen[q-128] = byte(qLen)
}
}
} else {
if q == 255 {
return errNoQTable