aboutsummaryrefslogtreecommitdiffstats
path: root/mobile
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-02-22 02:21:41 +0800
committerGitHub <noreply@github.com>2018-02-22 02:21:41 +0800
commit45ce4dce3f9e9058d599fab85e4f5b8b7c9393cb (patch)
tree4da9949a6f82b64f1f423d8c2657c12076a698f5 /mobile
parentf54506ccf8c4a14758127d7ae24de5f5f0fd0b19 (diff)
parenta6787a6308d2109006b036c8a6a331afa938912d (diff)
downloadgo-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')
-rw-r--r--mobile/bind.go18
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
}