From e322774d74dfdc4f191289a88cd42d84aba727fb Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Wed, 10 Feb 2016 09:30:35 -0800
Subject: Fix issue with searching for short strings

---
 web/react/components/search_results.jsx | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

(limited to 'web/react/components/search_results.jsx')

diff --git a/web/react/components/search_results.jsx b/web/react/components/search_results.jsx
index 4adc3afe0..12c066734 100644
--- a/web/react/components/search_results.jsx
+++ b/web/react/components/search_results.jsx
@@ -15,13 +15,16 @@ function getStateFromStores() {
     const results = SearchStore.getSearchResults();
 
     const channels = new Map();
-    const channelIds = results.order.map((postId) => results.posts[postId].channel_id);
-    for (const id of channelIds) {
-        if (channels.has(id)) {
-            continue;
-        }
 
-        channels.set(id, ChannelStore.get(id));
+    if (results && results.order) {
+        const channelIds = results.order.map((postId) => results.posts[postId].channel_id);
+        for (const id of channelIds) {
+            if (channels.has(id)) {
+                continue;
+            }
+
+            channels.set(id, ChannelStore.get(id));
+        }
     }
 
     return {
-- 
cgit v1.2.3-1-g7c22

