From 12efe8675e5f0591308c10949174e64e42eb1f04 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Mon, 1 Feb 2016 08:01:49 -0500
Subject: Fix console errors

---
 web/react/components/sidebar.jsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index c902731c9..fdd069bb2 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -182,7 +182,10 @@ export default class Sidebar extends React.Component {
 
             let currentChannelName = channel.display_name;
             if (channel.type === 'D') {
-                currentChannelName = Utils.getDirectTeammate(channel.id).username;
+                const teammate = Utils.getDirectTeammate(channel.id);
+                if (teammate != null) {
+                    currentChannelName = teammate.username;
+                }
             }
 
             const unread = this.getTotalUnreadCount();
-- 
cgit v1.2.3-1-g7c22

