diff --git a/stream/mts/psi/psi.go b/stream/mts/psi/psi.go index 2f4ab5ad..c2e30f9e 100644 --- a/stream/mts/psi/psi.go +++ b/stream/mts/psi/psi.go @@ -261,12 +261,10 @@ func (p *PSIBytes) HasDescriptor(tag int) Descriptor { if descs == nil { return nil } - for i := 0; i < len(descs); { - t := int(descs[i]) - if t == tag { + for i := 0; i < len(descs); i += 2 + int(descs[i+1]) { + if int(descs[i]) == tag { return descs[i : i+2+int(descs[i+1])] } - i += 2 + int(descs[i+1]) } return nil }