From 5d20cda25e4ec7ef53eb93cfd836f578fbccef65 Mon Sep 17 00:00:00 2001 From: Dreamer Date: Wed, 14 Aug 2024 11:33:20 +0800 Subject: [PATCH] fix panic --- x/evm/types/query.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/evm/types/query.go b/x/evm/types/query.go index 5e9a937130..830d873eb2 100644 --- a/x/evm/types/query.go +++ b/x/evm/types/query.go @@ -16,7 +16,9 @@ package types import ( + errorsmod "cosmossdk.io/errors" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + errortypes "github.com/cosmos/cosmos-sdk/types/errors" ) // UnpackInterfaces implements UnpackInterfacesMesssage.UnpackInterfaces @@ -26,9 +28,13 @@ func (m QueryTraceTxRequest) UnpackInterfaces(unpacker codectypes.AnyUnpacker) e return err } } + if m.Msg == nil { + return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "msg cannot be nil") + } return m.Msg.UnpackInterfaces(unpacker) } +// UnpackInterfaces implements UnpackInterfacesMesssage.UnpackInterfaces func (m QueryTraceBlockRequest) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { for _, msg := range m.Txs { if err := msg.UnpackInterfaces(unpacker); err != nil {