Skip to content

Commit

Permalink
Use packed encoding if there are any values, not just more than 1 (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
kellycampbell authored and jhump committed Aug 22, 2019
1 parent 9d66a93 commit c47b58f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codec/encode_fields.go
Expand Up @@ -65,7 +65,7 @@ func (cb *Buffer) EncodeFieldValue(fd *desc.FieldDescriptor, val interface{}) er
if err != nil {
return err
}
if isPacked(fd) && len(sl) > 1 &&
if isPacked(fd) && len(sl) > 0 &&
(wt == proto.WireVarint || wt == proto.WireFixed32 || wt == proto.WireFixed64) {
// packed repeated field
var packedBuffer Buffer
Expand Down

0 comments on commit c47b58f

Please sign in to comment.