mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
Merge pull request #1506 from maticnetwork/mardizzone/nil-check
fix nil pointer dereference on DoCall
This commit is contained in:
commit
f96d451905
1 changed files with 7 additions and 1 deletions
|
|
@ -1399,7 +1399,10 @@ func applyMessageWithEVM(ctx context.Context, evm *vm.EVM, msg *core.Message, st
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("err: %w (supplied gas %d)", err, msg.GasLimit)
|
||||
return nil, fmt.Errorf("err: %w (supplied gas %d)", err, msg.GasLimit)
|
||||
}
|
||||
if result == nil {
|
||||
return nil, errors.New("EVM ApplyMessage returned nil result without error")
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
|
@ -1463,6 +1466,9 @@ func (api *BlockChainAPI) CallWithState(ctx context.Context, args TransactionArg
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result == nil {
|
||||
return nil, fmt.Errorf("DoCall returned nil result with no error (block=%v)", blockNrOrHash)
|
||||
}
|
||||
|
||||
if int(api.b.RPCRpcReturnDataLimit()) > 0 && len(result.ReturnData) > int(api.b.RPCRpcReturnDataLimit()) {
|
||||
return nil, fmt.Errorf("call returned result of length %d exceeding limit %d", len(result.ReturnData), int(api.b.RPCRpcReturnDataLimit()))
|
||||
|
|
|
|||
Loading…
Reference in a new issue