Skip to content

Commit 45ce4dc

Browse files
authored
Merge pull request #15776 from ProChain/master
accounts/abi: Fix the bug of mobile framework crashing
2 parents f54506c + a6787a6 commit 45ce4dc

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

‎mobile/bind.go‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,20 @@ func (c *BoundContract) GetDeployer() *Transaction {
154154
// Call invokes the (constant) contract method with params as input values and
155155
// sets the output to result.
156156
func (c *BoundContract) Call(opts *CallOpts, out *Interfaces, method string, args *Interfaces) error {
157-
results := make([]interface{}, len(out.objects))
158-
copy(results, out.objects)
159-
if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil {
160-
return err
157+
if len(out.objects) == 1 {
158+
result := out.objects[0]
159+
if err := c.contract.Call(&opts.opts, result, method, args.objects...); err != nil {
160+
return err
161+
}
162+
out.objects[0] = result
163+
} else {
164+
results := make([]interface{}, len(out.objects))
165+
copy(results, out.objects)
166+
if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil {
167+
return err
168+
}
169+
copy(out.objects, results)
161170
}
162-
copy(out.objects, results)
163171
return nil
164172
}
165173

0 commit comments

Comments
 (0)