fix: set default response if nil

This commit is contained in:
Richard Ramos 2022-08-19 12:00:20 -04:00
parent 8911f48e82
commit 8d885febf7
No known key found for this signature in database
GPG Key ID: BD36D48BC9FFC88C
1 changed files with 6 additions and 0 deletions

View File

@ -404,6 +404,12 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec
return nil, err return nil, err
} }
if historyResponseRPC.Response == nil {
historyResponseRPC.Response = new(pb.HistoryResponse)
historyResponseRPC.Response.PagingInfo = new(pb.PagingInfo)
historyResponseRPC.Response.PagingInfo.Cursor = new(pb.Index)
}
metrics.RecordMessage(ctx, "retrieved", len(historyResponseRPC.Response.Messages)) metrics.RecordMessage(ctx, "retrieved", len(historyResponseRPC.Response.Messages))
return historyResponseRPC.Response, nil return historyResponseRPC.Response, nil