Fix crash when pressing 'e' without selecting a vulnerability#23
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16
Changes
Initialize
selected_vuln_id,selected_package_name,selected_package_version, anddetailed_textattributes toNonein__init__.Problem
When the user pressed 'e' to explain a vulnerability before selecting any node in the tree view, grummage would crash with an
AttributeErrorbecause these attributes were not defined.Solution
By initializing these attributes to
Nonein the constructor, the existing check on line 460:now works correctly - when no vulnerability is selected, the condition evaluates to
Falseand 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