Commit 8a792bbc authored by hannahhoward's avatar hannahhoward

fix(message): check for nil selector

check for nil selector in a request and error if it is present
parent df4a18b1
......@@ -259,10 +259,14 @@ func (gsm *graphSyncMessage) ToProto() (*pb.Message, error) {
pbm := new(pb.Message)
pbm.Requests = make([]pb.Message_Request, 0, len(gsm.requests))
for _, request := range gsm.requests {
selector, err := ipldutil.EncodeNode(request.selector)
var selector []byte
var err error
if request.selector != nil {
selector, err = ipldutil.EncodeNode(request.selector)
if err != nil {
return nil, err
}
}
pbm.Requests = append(pbm.Requests, pb.Message_Request{
Id: int32(request.id),
Root: request.root.Bytes(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment