Skip to content

Commit

Permalink
Avoiding accessing undefined tributeValues #26461 (#26462)
Browse files Browse the repository at this point in the history
Backport #26461
  • Loading branch information
wxiaoguang authored Aug 12, 2023
1 parent 2bdc38e commit 9112ce2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web_src/js/features/tribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function makeCollections({mentions, emoji}) {

if (mentions) {
collections.push({
values: window.config.tributeValues,
values: window.config.tributeValues ?? [],
requireLeadingSpace: true,
menuItemTemplate: (item) => {
return `
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/utils/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function matchMention(queryText) {

// results is a map of weights, lower is better
const results = new Map();
for (const obj of window.config.tributeValues) {
for (const obj of window.config.tributeValues ?? []) {
const index = obj.key.toLowerCase().indexOf(query);
if (index === -1) continue;
const existing = results.get(obj);
Expand Down

0 comments on commit 9112ce2

Please sign in to comment.