From 778e89aab4bbca74545a24375ff608342c170766 Mon Sep 17 00:00:00 2001
From: enahum <nahumhbl@gmail.com>
Date: Wed, 14 Dec 2016 12:27:54 -0300
Subject: Fix JS error when someone posts a message in a another team (#4791)

---
 webapp/stores/notification_store.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'webapp/stores/notification_store.jsx')

diff --git a/webapp/stores/notification_store.jsx b/webapp/stores/notification_store.jsx
index d5e8acb4d..9d0e6c790 100644
--- a/webapp/stores/notification_store.jsx
+++ b/webapp/stores/notification_store.jsx
@@ -107,7 +107,8 @@ class NotificationStoreClass extends EventEmitter {
             // Notify if you're not looking in the right channel or when
             // the window itself is not active
             const activeChannel = ChannelStore.getCurrent();
-            const notify = activeChannel.id !== channel.id || !this.inFocus;
+            const channelId = channel ? channel.id : null;
+            const notify = activeChannel.id !== channelId || !this.inFocus;
 
             if (notify) {
                 Utils.notifyMe(title, body, channel, teamId, duration, !sound);
-- 
cgit v1.2.3-1-g7c22

