Skip to content

Commit 9814f02

Browse files
hilbixpires
authored andcommitted
header.go prevent otherHeader.rawTLVs being nil
If header.Version != otherHeader.Version then otherHeader.rawTLVs is not present.
1 parent 21542e2 commit 9814f02

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

header.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ func (header *Header) EqualsTo(otherHeader *Header) bool {
155155
if otherHeader == nil {
156156
return false
157157
}
158-
// TLVs only exist for version 2
159-
if header.Version == 2 && !bytes.Equal(header.rawTLVs, otherHeader.rawTLVs) {
158+
if header.Version != otherHeader.Version || header.Command != otherHeader.Command || header.TransportProtocol != otherHeader.TransportProtocol {
160159
return false
161160
}
162-
if header.Version != otherHeader.Version || header.Command != otherHeader.Command || header.TransportProtocol != otherHeader.TransportProtocol {
161+
// TLVs only exist for version 2
162+
if header.Version == 2 && !bytes.Equal(header.rawTLVs, otherHeader.rawTLVs) {
163163
return false
164164
}
165165
// Return early for header with LOCAL command, which contains no address information

0 commit comments

Comments
 (0)