Skip to content

Commit e7cd627

Browse files
committed
accounts/abi: fix for one output interface crashing
1 parent f7ca03a commit e7cd627

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎accounts/abi/argument.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ func (arguments Arguments) unpackAtomic(v interface{}, output []byte) error {
169169
if err != nil {
170170
return err
171171
}
172+
173+
// if we reach this part, there is only one output member from the contract event.
174+
// for mobile, the result type is always a slice.
175+
if reflect.Slice == value.Kind() && value.Len() >= 1 {
176+
//check if it's not a byte slice
177+
if reflect.TypeOf([]byte{}) != value.Type() {
178+
value = value.Index(0).Elem()
179+
}
180+
}
181+
172182
return set(value, reflect.ValueOf(marshalledValue), arg)
173183
}
174184

0 commit comments

Comments
 (0)