Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

AsterDY
Copy link
Collaborator

@AsterDY AsterDY commented Feb 28, 2024

Reproduce Code

func TestNodeSortKeys2(t *testing.T) {
    root, err := NewSearcher(_TwitterJson).GetByPath()
    if err != nil {
        t.Fatal(err)
    }
    t.Run("single", func(t *testing.T) {
        r := root.Get("statuses")
        if r.Check() != nil {
            t.Fatal(r.Error())
        }
        require.NoError(t, root.SortKeys(false))
    })
    t.Run("recurse", func(t *testing.T) {
        require.NoError(t, root.SortKeys(true))
    })
}
--  runtime error: invalid memory address or nil pointer dereference 

Reason

sortKey() use unsafeMap() at the beginning , which doesn't considerV_RAW type nodes

@AsterDY AsterDY merged commit 3739ffe into main Feb 28, 2024
@AsterDY AsterDY deleted the fix/ast_sort branch February 28, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants