Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic if templates dir does not exist #95

Closed
jduepmeier opened this issue Jul 22, 2024 · 0 comments · Fixed by #96
Closed

panic if templates dir does not exist #95

jduepmeier opened this issue Jul 22, 2024 · 0 comments · Fixed by #96

Comments

@jduepmeier
Copy link

If the templates folder does not exist the ls will panic.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x105854460]

goroutine 67 [running]:
github.com/mrjosh/helm-ls/internal/handler.(*langHandler).LoadDocsOnNewChart.func1({0x14000054740, 0x3f}, {0x0?, 0x0?}, {0x14000054740?, 0x3f?})
  github.com/mrjosh/helm-ls/internal/handler/text_document.go:109 +0x30\npath/filepath.WalkDir({0x14000054740, 0x3f}, 0x14000329f68)
  path/filepath/path.go:530 +0x50\ngit.luolix.top/mrjosh/helm-ls/internal/handler.(*langHandler).LoadDocsOnNewChart(0x140001e7880, {0x1400076e340?, 0x14000346190?})
  github.com/mrjosh/helm-ls/internal/handler/text_document.go:107 +0x84
created by github.com/mrjosh/helm-ls/internal/handler.(*langHandler).NewChartWithInitActions in goroutine 13
  github.com/mrjosh/helm-ls/internal/handler/initialization.go:100 +0xa8

The WalkDir function used here will call the WalkFunc with the error and fs info nil if the directory does not exist (see https://pkg.go.dev/path/filepath#WalkFunc). The current walk function does not check this error and panics.
https://github.com/mrjosh/helm-ls/blob/master/internal/handler/text_document.go#L108

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 a pull request may close this issue.

1 participant