Skip to content

Commit f50cd95

Browse files
author
Erichin
committed
bugfix
1 parent 0c13ee4 commit f50cd95

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

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)