Skip to content

Commit

Permalink
Merge pull request #11 from ElrondNetwork/protect-against-missing-sc-…
Browse files Browse the repository at this point in the history
…method

Add verification in RunSmartContractCall() against missing SC methods
  • Loading branch information
sasurobert authored Oct 29, 2019
2 parents e53417f + 029f60c commit ae44239
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arwen/arwen.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ func (host *vmContext) RunSmartContractCall(input *vmcommon.ContractCallInput) (
return host.createVMOutputInCaseOfError(vmcommon.UserError), nil
}

function := instance.Exports[host.callFunction]
function, ok := instance.Exports[host.callFunction]
if !ok {
fmt.Println("arwen Error", "Function not found")
return host.createVMOutputInCaseOfError(vmcommon.FunctionNotFound), nil
}

result, err := function()
if err != nil {
fmt.Println("arwen Error", err.Error())
Expand Down

0 comments on commit ae44239

Please sign in to comment.