Closed jduepmeier closed 4 months ago
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\ngithub.com/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
If the templates folder does not exist the ls will panic.
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