Skip to content

fix(file-history): guard update_components against nil render_data#77

Merged
dlyongemallo merged 1 commit intomainfrom
guard_nil_render_data
Mar 31, 2026
Merged

fix(file-history): guard update_components against nil render_data#77
dlyongemallo merged 1 commit intomainfrom
guard_nil_render_data

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 31, 2026 09:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a defensive nil guard in FileHistoryPanel:update_components() to prevent a crash when render_data is unexpectedly nil, and introduces a functional regression test suite to cover this and several related nil-guard fixes across the project.

Changes:

  • Guard FileHistoryPanel:update_components() against self.render_data == nil before calling :destroy() / creating components.
  • Add nil_guards_spec.lua functional tests covering multiple known nil-guard regressions, including the new FileHistoryPanel guard.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lua/diffview/scene/views/file_history/file_history_panel.lua Adds an early return in update_components() when render_data is nil to prevent a crash.
lua/diffview/tests/functional/nil_guards_spec.lua Adds functional regression tests for several nil-guard scenarios, including FileHistoryPanel:update_components() with nil render_data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dlyongemallo dlyongemallo merged commit a64f028 into main Mar 31, 2026
6 checks passed
@dlyongemallo dlyongemallo deleted the guard_nil_render_data branch March 31, 2026 09:28
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