diff options
author | Martin Holst Swende <martin@swende.se> | 2018-02-22 02:21:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-22 02:21:41 +0800 |
commit | 45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb (patch) | |
tree | 4da9949a6f82b64f1f423d8c2657c12076a698f5 /mobile/bind.go | |
parent | f54506ccf8c4a14758127d7ae24de5f5f0fd0b19 (diff) | |
parent | a6787a6308d2109006b036c8a6a331afa938912d (diff) | |
download | go-tangerine-45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb.tar go-tangerine-45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb.tar.gz go-tangerine-45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb.tar.bz2 go-tangerine-45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb.tar.lz go-tangerine-45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb.tar.xz go-tangerine-45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb.tar.zst go-tangerine-45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb.zip |
Merge pull request #15776 from ProChain/master
accounts/abi: Fix the bug of mobile framework crashing
Diffstat (limited to 'mobile/bind.go')
-rw-r--r-- | mobile/bind.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/mobile/bind.go b/mobile/bind.go index 7a1bf9e60..d6e621a25 100644 --- a/mobile/bind.go +++ b/mobile/bind.go @@ -154,12 +154,20 @@ func (c *BoundContract) GetDeployer() *Transaction { // Call invokes the (constant) contract method with params as input values and // sets the output to result. func (c *BoundContract) Call(opts *CallOpts, out *Interfaces, method string, args *Interfaces) error { - results := make([]interface{}, len(out.objects)) - copy(results, out.objects) - if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil { - return err + if len(out.objects) == 1 { + result := out.objects[0] + if err := c.contract.Call(&opts.opts, result, method, args.objects...); err != nil { + return err + } + out.objects[0] = result + } else { + results := make([]interface{}, len(out.objects)) + copy(results, out.objects) + if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil { + return err + } + copy(out.objects, results) } - copy(out.objects, results) return nil } |