From 2f7d6eb0d8019ca3d55d04d63539257d8fe1d614 Mon Sep 17 00:00:00 2001 From: Jakob Krigovsky Date: Fri, 26 May 2017 09:43:11 +0200 Subject: [PATCH] Guard buildSearch() against undefined properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is important if custom emojis don’t specify any emoticons, for example. --- src/utils/build-search.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/build-search.js b/src/utils/build-search.js index 6add9de..4305e76 100644 --- a/src/utils/build-search.js +++ b/src/utils/build-search.js @@ -2,6 +2,10 @@ module.exports = data => { const search = [] var addToSearch = (strings, split) => { + if (!strings) { + return + } + (Array.isArray(strings) ? strings : [strings]).forEach((string) => { (split ? string.split(/[-|_|\s]+/) : [string]).forEach((s) => { s = s.toLowerCase()