Skip to content

fix: prevent panic when navigating with no sections loaded#817

Merged
dlvhdr merged 1 commit intodlvhdr:mainfrom
sideshowbarker:fix/nil-section-panic
Mar 27, 2026
Merged

fix: prevent panic when navigating with no sections loaded#817
dlvhdr merged 1 commit intodlvhdr:mainfrom
sideshowbarker:fix/nil-section-panic

Conversation

@sideshowbarker
Copy link
Copy Markdown
Contributor

Bug: Quickly pressing the s key to switch views during startup causes a panic (nil pointer dereference).

Cause: Switching to a view whose sections haven’t loaded yet makes getCurrSection() return nil. The Down, Up, FirstLine, LastLine, and Refresh key handlers call methods on currSection without nil checks.

Fix: Guard the handlers with a currSection != nil check, matching what dash already does for Search and PrevSection/NextSection.

Fixes #812

Bug: Quickly pressing the “s” key to switch views during startup causes
a panic (nil pointer dereference).

Cause: Switching to a view whose sections haven’t loaded yet makes
getCurrSection() return nil. The Down, Up, FirstLine, LastLine, and
Refresh key handlers call methods on currSection without nil checks.

Fix: Guard the handlers with a currSection != nil check, matching what
dash already does for Search and PrevSection/NextSection.

Fixes dlvhdr#812
Copy link
Copy Markdown
Owner

@dlvhdr dlvhdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice

@dlvhdr dlvhdr merged commit f0b67d7 into dlvhdr:main Mar 27, 2026
3 checks passed
@sideshowbarker sideshowbarker deleted the fix/nil-section-panic branch March 27, 2026 15:23
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] crashed on navigating multiple windows

2 participants