This repository was archived by the owner on Jul 22, 2024. It is now read-only.
fix: panic when Decode's input is array and output is a slice#265
Merged
mitchellh merged 2 commits intomitchellh:masterfrom Apr 20, 2022
suzuki-shunsuke:fix/fix-issue-264
Merged
fix: panic when Decode's input is array and output is a slice#265mitchellh merged 2 commits intomitchellh:masterfrom suzuki-shunsuke:fix/fix-issue-264
mitchellh merged 2 commits intomitchellh:masterfrom
suzuki-shunsuke:fix/fix-issue-264
Conversation
suzuki-shunsuke
commented
Dec 23, 2021
|
|
||
| // If the input value is nil, then don't allocate since empty != nil | ||
| if dataVal.IsNil() { | ||
| if dataValKind != reflect.Array && dataVal.IsNil() { |
Contributor
Author
There was a problem hiding this comment.
https://pkg.go.dev/reflect#Value.IsNil
The argument must be a chan, func, interface, map, pointer, or slice value; if it is not, IsNil panics.
suzuki-shunsuke
commented
Dec 23, 2021
| } | ||
| } | ||
|
|
||
| func TestDecode_decodeSliceWithArray(t *testing.T) { |
Contributor
Author
There was a problem hiding this comment.
I'm sorry but I don't know how to add tests in this repository.
If this isn't good, please let me know.
I'll fix.
Owner
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #264
Test
I have confirmed the issue is reproduced by 74cdd45
And the issue is solved by ab94595