mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-05-24 01:19:36 +00:00
fix nil pointer dereference in copyRPC
This commit is contained in:
parent
de4adefafb
commit
73b338aa6d
17
comm.go
17
comm.go
@ -124,17 +124,20 @@ func rpcWithControl(msgs []*pb.Message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func copyRPC(rpc *RPC) *RPC {
|
func copyRPC(rpc *RPC) *RPC {
|
||||||
return &RPC{
|
res := &RPC{
|
||||||
RPC: pb.RPC{
|
RPC: pb.RPC{
|
||||||
Subscriptions: rpc.Subscriptions,
|
Subscriptions: rpc.Subscriptions,
|
||||||
Publish: rpc.Publish,
|
Publish: rpc.Publish,
|
||||||
Control: &pb.ControlMessage{
|
|
||||||
Ihave: rpc.Control.Ihave,
|
|
||||||
Iwant: rpc.Control.Iwant,
|
|
||||||
Graft: rpc.Control.Graft,
|
|
||||||
Prune: rpc.Control.Prune,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
from: rpc.from,
|
from: rpc.from,
|
||||||
}
|
}
|
||||||
|
if rpc.Control != nil {
|
||||||
|
res.Control = &pb.ControlMessage{
|
||||||
|
Ihave: rpc.Control.Ihave,
|
||||||
|
Iwant: rpc.Control.Iwant,
|
||||||
|
Graft: rpc.Control.Graft,
|
||||||
|
Prune: rpc.Control.Prune,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user