-
Notifications
You must be signed in to change notification settings - Fork 1
fix: suppress removed entity error in gui status code #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Nevermind, this is a bandaid not a fix. |
There was a problem hiding this 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()withunwrap_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()) |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
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.
| ), | ||
| table::column(text("Status"), |entry: ModEntry| { | ||
| checkbox(entry.enabled().unwrap()) | ||
| checkbox(entry.enabled().unwrap_or_default()) |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
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.
| 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) |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Resolved #84