Skip to content

fix: panic: runtime error: index out of range [0] with length 0#5153

Open
majiayu000 wants to merge 1 commit intojesseduffield:masterfrom
majiayu000:fix-5148-panic-runtime-error-index-out--1231-0742
Open

fix: panic: runtime error: index out of range [0] with length 0#5153
majiayu000 wants to merge 1 commit intojesseduffield:masterfrom
majiayu000:fix-5148-panic-runtime-error-index-out--1231-0742

Conversation

@majiayu000
Copy link

Fixes #5148

Changes

  • Add bounds checking in findHyperlinkAt() to prevent panic when viewLines changes between caller's bounds check and access
  • Return nil safely when x or y indices are out of range

Add defensive bounds checking in findHyperlinkAt() to prevent
"runtime error: index out of range [0] with length 0" panic.
This handles race conditions where viewLines may change between
the caller's bounds check and the function's access.

Fixes jesseduffield#5148

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: majiayu000 <1835304752@qq.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.

panic: runtime error: index out of range [0] with length 0

1 participant