Skip to content

fix(parser): nil check before calling parse on treesitter parser#492

Closed
bumaociyuan wants to merge 2 commits intoOXY2DEV:mainfrom
bumaociyuan:main
Closed

fix(parser): nil check before calling parse on treesitter parser#492
bumaociyuan wants to merge 2 commits intoOXY2DEV:mainfrom
bumaociyuan:main

Conversation

@bumaociyuan
Copy link
Copy Markdown
Contributor

Summary

  • Add nil check for get_parser() result before calling :parse()
  • Fixes "attempt to index a nil value" error at parser.lua:153

Root Cause

When vim.treesitter.get_parser(buffer) returns nil, the code was still calling :parse(true) on the nil value, causing the crash.

Fix

Store the parser result in a variable, check for nil, then call :parse() only if parser exists.

Related Issue

Fixes #488

🤖 Generated with Claude Code

When get_parser returns nil, attempting to call :parse() on it causes
"attempt to index a nil value" error. This fixes issue OXY2DEV#488.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Simplify to essential features and setup
- Add bug fixes section
- Update installation to point to fork

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@OXY2DEV
Copy link
Copy Markdown
Owner

OXY2DEV commented Apr 18, 2026

@bumaociyuan remove the modifications of README.md

If it needs to be modified, do it in a separate PR.

@OXY2DEV OXY2DEV closed this in 05ce5a6 Apr 18, 2026
OXY2DEV added a commit that referenced this pull request Apr 18, 2026
Based on the commit from ZX.

Closes: #492
Closes: #488
Co-author: zhengxin5 <zx19880528@gmail.com>
OXY2DEV added a commit that referenced this pull request Apr 18, 2026
Based on the commit from ZX.

Closes: #492
Closes: #488

Co-authored-by: zhengxin5 <zx19880528@gmail.com>
bumaociyuan added a commit to bumaociyuan/markview.nvim that referenced this pull request Apr 18, 2026
Based on the commit from ZX.

Closes: OXY2DEV#492
Closes: OXY2DEV#488

Co-authored-by: zhengxin5 <zx19880528@gmail.com>
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.

🐞 Bug: Crashing with nvim v0.12.1

2 participants