Skip to content

Conversation

@ahangsu
Copy link
Contributor

@ahangsu ahangsu commented Mar 23, 2022

Description

On the input of array in golang to function inferToSlice, the previous implementation will try to infer IsNil from interface value, while this will cause panic.

Solution here is to remove following code snippet

	if reflectVal.IsNil() {
		if reflectVal.Kind() == reflect.Slice {
			return nil, nil
		}
		return nil, fmt.Errorf("cannot infer nil value for array kind interface")
	}

since on passing nil slice, we still want to return an empty (len == 0) slice of interface, rather than a nil slice, which will cause trouble in implementation.

This is a fix for algorand/go-algorand-sdk#302

@ahangsu ahangsu requested a review from jasonpaulos March 23, 2022 00:30
@ahangsu ahangsu changed the title ABI encode infer to slice IsNil handler removal Bug-Fix: ABI encode infer to slice IsNil handler removal Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants