Repository navigation
Refuse a null chord in BindChord, ExecuteChord and FindCommandByChord whatever the profile [patch] - #231
Open
matt-edmondson wants to merge 1 commit into
Open
Refuse a null chord in BindChord, ExecuteChord and FindCommandByChord whatever the profile [patch]#231matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
… whatever the profile [patch] The chord check ran after the blank-profile, blank-command and no-active-profile early returns, so a null chord returned false/null in a test with no profile and threw ArgumentNullException in an app with one. Every chord-taking overload now checks the chord first, and IKeybindingService documents the exception. Fixes #230 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW499sBmEvZWVdPTbTv
Contributor
Author
|
The I tried to re-run the job, but GitHub refused with "This workflow run cannot be retried", so this PR has no fix to push. A re-run from the Actions page, or the next push, should clear it. Generated by Claude Code |
|
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 #230
What was wrong
KeybindingServicechecked the chord only after its early returns. When no profile was active, or the profile or command id was blank, a null chord came back asfalse/null. With a profile active, it threwArgumentNullException. So a caller passing a null chord passed tests that set up no profile, then crashed in the app.Change
Ensure.NotNull(chord)is now the first statement of all six chord-taking overloads: the active-profile and explicit-profile versions ofBindChord,ExecuteChordandFindCommandByChord.IKeybindingServicelistsArgumentNullExceptionfor those six members.Tests
New
NullChordArgumentTests:With the service change reverted, 7 of 9 cases fail. The active-profile case and the unknown-profile case already threw before this change, and they stay as guards.
Full suite on Linux / .NET 10: 390/390 passed.
Generated by Claude Code