Merge pull request #1179 from matrix-org/luke/fix-query-matcher-empty-query

Don't try to match with an empty query string
This commit is contained in:
Luke Barnard 2017-07-05 18:20:25 +01:00 committed by GitHub
commit 89d0ec4de8

View file

@ -86,6 +86,9 @@ export default class QueryMatcher {
if (this.options.shouldMatchWordsOnly) { if (this.options.shouldMatchWordsOnly) {
query = query.replace(/[^\w]/g, ''); query = query.replace(/[^\w]/g, '');
} }
if (query.length === 0) {
return [];
}
const results = []; const results = [];
this.keyMap.keys.forEach((key) => { this.keyMap.keys.forEach((key) => {
let resultKey = key.toLowerCase(); let resultKey = key.toLowerCase();