Skip to content

Conversation

@Kruziikrel13
Copy link
Collaborator

Resolved #84

Copilot AI review requested due to automatic review settings January 22, 2026 05:27
@Kruziikrel13
Copy link
Collaborator Author

Nevermind, this is a bandaid not a fix.

Copy link

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 fixes a panic that occurs when the GUI attempts to display the status of a deleted mod entry. The fix changes entry.enabled().unwrap() to use unwrap_or_default() instead, which returns false when a RemovedEntity error occurs.

Changes:

  • Replaced unwrap() with unwrap_or_default() for the enabled status checkbox to prevent panics when entities are deleted

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

),
table::column(text("Status"), |entry: ModEntry| {
checkbox(entry.enabled().unwrap())
checkbox(entry.enabled().unwrap_or_default())
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The same RemovedEntity error can occur on line 115 where entry.name().unwrap() is called. This should also use unwrap_or_default() or similar error handling to prevent panics when entities are deleted.

Copilot uses AI. Check for mistakes.
),
table::column(text("Status"), |entry: ModEntry| {
checkbox(entry.enabled().unwrap())
checkbox(entry.enabled().unwrap_or_default())
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

Using unwrap_or_default() silently defaults to false for deleted entities, which may mask legitimate errors. Consider filtering out removed entities from the mod list before rendering, or explicitly handling the error case with proper user feedback.

Suggested change
checkbox(entry.enabled().unwrap_or_default())
let is_enabled = match entry.enabled() {
Ok(value) => value,
Err(err) => {
eprintln!("Failed to read enabled state for {:?}: {}", entry, err);
false
}
};
checkbox(is_enabled)

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
barnacle-gui/src/components/mod_list/mod.rs 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
barnacle-gui/src/components/mod_list/mod.rs 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

GUI: Barnacle crashes on removing a profile that contains mods

1 participant