Fix a crash when parsing nested function calls (see added test case). #28
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.
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10f0e78]
goroutine 78 [running]:
testing.tRunner.func1.2({0x1106160, 0x1209f70})
/usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1212 +0x218
panic({0x1106160, 0x1209f70})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/kanmu/go-sqlfmt/sqlfmt/parser.(*Retriever).appendGroupsToResult(0x0)
go-sqlfmt/sqlfmt/parser/retriever.go:94 +0x38
github.com/kanmu/go-sqlfmt/sqlfmt/parser.(*Retriever).Retrieve(0x0)
go-sqlfmt/sqlfmt/parser/retriever.go:79 +0x1e
github.com/kanmu/go-sqlfmt/sqlfmt/parser.ParseTokens({0xc000239b00, 0x11, 0x20})
go-sqlfmt/sqlfmt/parser/parser.go:36 +0x17d