Browse Source

proto: replace len(b)<=0 with len(b)==0 (#706)

len never returns negative values, so len(b)==0 states
requirements in a more clear way with less "uncertainty".
Iskander (Alex) Sharipov 7 years ago
parent
commit
2f5a26c505
1 changed files with 1 additions and 1 deletions
  1. 1 1
      proto/table_unmarshal.go

+ 1 - 1
proto/table_unmarshal.go

@@ -1948,7 +1948,7 @@ func encodeVarint(b []byte, x uint64) []byte {
 // If there is an error, it returns 0,0.
 func decodeVarint(b []byte) (uint64, int) {
 	var x, y uint64
-	if len(b) <= 0 {
+	if len(b) == 0 {
 		goto bad
 	}
 	x = uint64(b[0])