diff --git a/types/query/format_page_request.go b/types/query/format_page_request.go index b2dcf37..52df2be 100644 --- a/types/query/format_page_request.go +++ b/types/query/format_page_request.go @@ -3,11 +3,15 @@ package query import sdk "github.com/irisnet/core-sdk-go/types" const ( + PageReqNilErrMsg = "pageRequest error: PageRequest cannot be nil" CountTotalErrMsg = "pageRequest error: CountTotal is not supported, must be false" LimitErrMsg = "pageRequest error: Limit cannot be empty and cannot exceed 100" ) func FormatPageRequest(pageReq *PageRequest) (*PageRequest, sdk.Error) { + if pageReq == nil { + return pageReq, sdk.Wrapf(PageReqNilErrMsg) + } if pageReq.CountTotal { return pageReq, sdk.Wrapf(CountTotalErrMsg) }