Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues with handling invalid regex in syntax files (zyedidia#2913)
* Fix panic due to invalid regex in a syntax file When a user's custom syntax file has a malformed filename regex or header regex, MakeHeaderYaml() returns error but we do not properly handle it, which results in a panic due to a dereference of the `header` pointer which is nil: Micro encountered an error: runtime.errorString runtime error: invalid memory address or nil pointer dereference runtime/panic.go:221 (0x44c367) runtime/panic.go:220 (0x44c337) github.com/zyedidia/micro/v2/internal/buffer/buffer.go:709 (0x82bc0f) github.com/zyedidia/micro/v2/internal/buffer/buffer.go:392 (0x828292) github.com/zyedidia/micro/v2/internal/buffer/buffer.go:261 (0x8278c8) github.com/zyedidia/micro/v2/cmd/micro/micro.go:203 (0x8b9e7b) github.com/zyedidia/micro/v2/cmd/micro/micro.go:331 (0x8ba9e5) runtime/proc.go:255 (0x4386a7) runtime/asm_amd64.s:1581 (0x467941) * Do not ignore invalid filename regex error in a syntax file When the filename regex in a syntax file is malformed but the subsequent header regex is correct, the filename regex error gets silently ignored, since the `err` value is overwritten by the subsequent successful header regex result.
- Loading branch information