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

Fix crash when syntax file has no rules #3213

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Mar 24, 2024

If a syntax file aaa.yaml contains no rules directive, then after set filetype aaa micro crashes with d.rules nil pointer dereference in HasIncludes():

Micro encountered an error: runtime.errorString runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:221 (0x44c527)
runtime/panic.go:220 (0x44c4f7)
github.com/zyedidia/micro/v2/pkg/highlight/parser.go:239 (0x820919)
github.com/zyedidia/micro/v2/internal/buffer/buffer.go:830 (0x82b818)
github.com/zyedidia/micro/v2/internal/buffer/settings.go:33 (0x83b665)
github.com/zyedidia/micro/v2/internal/action/command.go:578 (0x87d75f)
github.com/zyedidia/micro/v2/internal/action/command.go:598 (0x87da79)
github.com/zyedidia/micro/v2/internal/action/command.go:634 (0x87de54)
github.com/zyedidia/micro/v2/internal/action/command.go:1030 (0x880f68)
github.com/zyedidia/micro/v2/internal/action/actions.go:1545 (0x870d72)
github.com/zyedidia/micro/v2/internal/info/infobuffer.go:152 (0x8421b4)
github.com/zyedidia/micro/v2/internal/action/infopane.go:208 (0x8854cc)
github.com/zyedidia/micro/v2/internal/action/infopane.go:54 (0x8844d6)
github.com/zyedidia/micro/v2/internal/action/infopane.go:131 (0x884d42)
github.com/zyedidia/micro/v2/internal/action/infopane.go:95 (0x8849ff)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:481 (0x8bfb86)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:397 (0x8bf63e)
runtime/proc.go:255 (0x438867)
runtime/asm_amd64.s:1581 (0x467a81)

If a syntax file aaa.yaml contains no `rules` directive, then after
`set filetype aaa` micro crashes with d.rules nil pointer dereference
in HasIncludes():

Micro encountered an error: runtime.errorString runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:221 (0x44c527)
runtime/panic.go:220 (0x44c4f7)
github.com/zyedidia/micro/v2/pkg/highlight/parser.go:239 (0x820919)
github.com/zyedidia/micro/v2/internal/buffer/buffer.go:830 (0x82b818)
github.com/zyedidia/micro/v2/internal/buffer/settings.go:33 (0x83b665)
github.com/zyedidia/micro/v2/internal/action/command.go:578 (0x87d75f)
github.com/zyedidia/micro/v2/internal/action/command.go:598 (0x87da79)
github.com/zyedidia/micro/v2/internal/action/command.go:634 (0x87de54)
github.com/zyedidia/micro/v2/internal/action/command.go:1030 (0x880f68)
github.com/zyedidia/micro/v2/internal/action/actions.go:1545 (0x870d72)
github.com/zyedidia/micro/v2/internal/info/infobuffer.go:152 (0x8421b4)
github.com/zyedidia/micro/v2/internal/action/infopane.go:208 (0x8854cc)
github.com/zyedidia/micro/v2/internal/action/infopane.go:54 (0x8844d6)
github.com/zyedidia/micro/v2/internal/action/infopane.go:131 (0x884d42)
github.com/zyedidia/micro/v2/internal/action/infopane.go:95 (0x8849ff)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:481 (0x8bfb86)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:397 (0x8bf63e)
runtime/proc.go:255 (0x438867)
runtime/asm_amd64.s:1581 (0x467a81)
@dmaluka dmaluka merged commit 08892b1 into zyedidia:master Mar 25, 2024
3 checks passed
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