Browse Source

Fix metadata requests on later versions

If the set of Topics is an empty array, we don't need to put it in the
request or we'll just get an empty set of data back which is useless.
As far as I can tell the nil check was for safety, but len(nil) is
already safe and the boolean logic was wrong anyway.
Evan Huus 6 years ago
parent
commit
46821574be
1 changed files with 1 additions and 1 deletions
  1. 1 1
      metadata_request.go

+ 1 - 1
metadata_request.go

@@ -10,7 +10,7 @@ func (r *MetadataRequest) encode(pe packetEncoder) error {
 	if r.Version < 0 || r.Version > 5 {
 		return PacketEncodingError{"invalid or unsupported MetadataRequest version field"}
 	}
-	if r.Version == 0 || r.Topics != nil || len(r.Topics) > 0 {
+	if r.Version == 0 || len(r.Topics) > 0 {
 		err := pe.putArrayLength(len(r.Topics))
 		if err != nil {
 			return err