Skip to content

fix: prevent crash when typing unknown slash commands#1152

Open
vivekyadav-3 wants to merge 1 commit into
RocketChat:developfrom
vivekyadav-3:fix/slash-command-crash
Open

fix: prevent crash when typing unknown slash commands#1152
vivekyadav-3 wants to merge 1 commit into
RocketChat:developfrom
vivekyadav-3:fix/slash-command-crash

Conversation

@vivekyadav-3
Copy link
Copy Markdown
Contributor

Fixes #1144 – Prevent crash on unknown slash commands

While testing slash commands, I found a bug where entering a command that doesn’t exist (for example /hello) could crash the app with a TypeError.

Root cause

We were accessing properties on a command object without first confirming the command actually exists. When an unknown command was submitted, the code tried to read from undefined, which caused the crash.

Fix

Added a guard to ensure a command is selected before trying to use it:

if (selectedItem) {
handleCommandClick(selectedItem);
}

Now, if a user types an unknown slash command, the app safely ignores it instead of crashing.

Copilot AI review requested due to automatic review settings February 11, 2026 15:22
Copy link
Copy Markdown

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@vivekyadav-3 vivekyadav-3 force-pushed the fix/slash-command-crash branch from 300f7ca to e1a49f9 Compare February 20, 2026 07:39
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 20, 2026

CLA assistant check
All committers have signed the CLA.

@vivekyadav-3
Copy link
Copy Markdown
Contributor Author

Hi! I just force-pushed to clean up this branch. It now strictly contains the 1-line null check to fix the crash. Sorry for the noise earlier! Ready for review when you are.

@vivekyadav-3 vivekyadav-3 force-pushed the fix/slash-command-crash branch from e1a49f9 to bebf3da Compare May 22, 2026 05:23
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.

Bug : Crash when typing unknown slash command (e.g., /hello)

3 participants