diff --git a/protocols/bgp/packet/path_attributes.go b/protocols/bgp/packet/path_attributes.go
index db23ea94322af1d58b85c0477c3fbf6696de11a9..52fad7ed2129c8527b73eafb7d2842607c8d4420 100644
--- a/protocols/bgp/packet/path_attributes.go
+++ b/protocols/bgp/packet/path_attributes.go
@@ -252,10 +252,10 @@ func (pa *PathAttribute) decodeCommunities(buf *bytes.Buffer) error {
 	coms := make([]uint32, count)
 
 	for i := uint16(0); i < count; i++ {
-		v, err = read4BytesAsUin32(buf)
-+		if err != nil {
-+			return err
-+		}
+		v, err := read4BytesAsUin32(buf)
+		if err != nil {
+			return err
+		}
 		coms[i] = v
 	}