Skip to content

Fix crash when pressing 'e' without selecting a vulnerability#23

Merged
popey merged 1 commit intomainfrom
fix-issue-16-explain-crash
Nov 16, 2025
Merged

Fix crash when pressing 'e' without selecting a vulnerability#23
popey merged 1 commit intomainfrom
fix-issue-16-explain-crash

Conversation

@popey
Copy link
Copy Markdown
Owner

@popey popey commented Nov 16, 2025

Fixes #16

Changes

Initialize selected_vuln_id, selected_package_name, selected_package_version, and detailed_text attributes to None in __init__.

Problem

When the user pressed 'e' to explain a vulnerability before selecting any node in the tree view, grummage would crash with an AttributeError because these attributes were not defined.

Solution

By initializing these attributes to None in the constructor, the existing check on line 460:

if key == "e" and self.selected_vuln_id and self.detailed_text:

now works correctly - when no vulnerability is selected, the condition evaluates to False and the explain action is skipped without crashing.

Testing

Tested by launching grummage and pressing 'e' immediately without selecting any vulnerability. The application no longer crashes.

🤖 Generated with Claude Code

Initialize selected_vuln_id, selected_package_name, selected_package_version,
and detailed_text attributes to None in __init__. This prevents AttributeError
when the user presses 'e' before selecting any vulnerability node.

Fixes #16

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

Co-Authored-By: Claude <noreply@anthropic.com>
@popey popey merged commit 64a228a into main Nov 16, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Crash when explaining vuln when no vuln selected

1 participant