Browse Source

returning nil on error fix

Sergey Kamardin 7 months ago
parent
commit
ce4ade58c6
1 changed files with 2 additions and 2 deletions
  1. 2 2
      base.go

+ 2 - 2
base.go

@@ -78,7 +78,7 @@ func (p Payload) SerializeTo(b SerializeBuffer, opts SerializeOptions) error {
 func decodePayload(data []byte, p PacketBuilder) error {
 	payload := &Payload{}
 	if err := payload.DecodeFromBytes(data, p); err != nil {
-		return nil
+		return err
 	}
 	p.AddLayer(payload)
 	p.SetApplicationLayer(payload)
@@ -132,7 +132,7 @@ func (p *Fragment) SerializeTo(b SerializeBuffer, opts SerializeOptions) error {
 func decodeFragment(data []byte, p PacketBuilder) error {
 	payload := &Fragment{}
 	if err := payload.DecodeFromBytes(data, p); err != nil {
-		return nil
+		return err
 	}
 	p.AddLayer(payload)
 	p.SetApplicationLayer(payload)