From 8d885febf7638897548fcdd965f2abb50c0bc9a7 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 19 Aug 2022 12:00:20 -0400 Subject: [PATCH] fix: set default response if nil --- waku/v2/protocol/store/waku_store.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/waku/v2/protocol/store/waku_store.go b/waku/v2/protocol/store/waku_store.go index f26c1431..1d82fe14 100644 --- a/waku/v2/protocol/store/waku_store.go +++ b/waku/v2/protocol/store/waku_store.go @@ -404,6 +404,12 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec 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)) return historyResponseRPC.Response, nil