Merge pull request #5015 from matrix-org/t3chguy/fix/14595

Fix slash commands null guard
This commit is contained in:
Michael Telatynski 2020-07-20 15:19:19 +01:00 committed by GitHub
commit dba54115ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1049,7 +1049,7 @@ export function parseCommandString(input) {
// trim any trailing whitespace, as it can confuse the parser for
// IRC-style commands
input = input.replace(/\s+$/, '');
if (input[0] !== '/') return null; // not a command
if (input[0] !== '/') return {}; // not a command
const bits = input.match(/^(\S+?)(?: +((.|\n)*))?$/);
let cmd;