diff --git a/action/protocol/execution/evm/evm.go b/action/protocol/execution/evm/evm.go index 3d980bdb4f..70613f2f1b 100644 --- a/action/protocol/execution/evm/evm.go +++ b/action/protocol/execution/evm/evm.go @@ -371,7 +371,7 @@ func ExecuteContract( } stateDB.clear() - if ps.featureCtx.SetRevertMessageToReceipt && receipt.Status == uint64(iotextypes.ReceiptStatus_ErrExecutionReverted) && retval != nil && bytes.Equal(retval[:4], _revertSelector) { + if ps.featureCtx.SetRevertMessageToReceipt && receipt.Status == uint64(iotextypes.ReceiptStatus_ErrExecutionReverted) && len(retval) >= 4 && bytes.Equal(retval[:4], _revertSelector) { // in case of the execution revert error, parse the retVal and add to receipt receipt.SetExecutionRevertMsg(ExtractRevertMessage(retval)) }