Skip to content

Commit

Permalink
header.go prevent otherHeader.rawTLVs being nil
Browse files Browse the repository at this point in the history
If header.Version != otherHeader.Version then otherHeader.rawTLVs
is not present.
  • Loading branch information
hilbix committed Oct 29, 2023
1 parent e5b291b commit 7095f70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions header.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ func (header *Header) EqualsTo(otherHeader *Header) bool {
if otherHeader == nil {
return false
}
// TLVs only exist for version 2
if header.Version == 2 && !bytes.Equal(header.rawTLVs, otherHeader.rawTLVs) {
if header.Version != otherHeader.Version || header.Command != otherHeader.Command || header.TransportProtocol != otherHeader.TransportProtocol {
return false
}
if header.Version != otherHeader.Version || header.Command != otherHeader.Command || header.TransportProtocol != otherHeader.TransportProtocol {
// TLVs only exist for version 2
if header.Version == 2 && !bytes.Equal(header.rawTLVs, otherHeader.rawTLVs) {
return false
}
// Return early for header with LOCAL command, which contains no address information
Expand Down

0 comments on commit 7095f70

Please sign in to comment.