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/navbar.jsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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

diff --git a/web/react/components/navbar.jsx b/web/react/components/navbar.jsx
index ae14fca2f..7326a9ef8 100644
--- a/web/react/components/navbar.jsx
+++ b/web/react/components/navbar.jsx
@@ -392,10 +392,14 @@ export default class Navbar extends React.Component {
             } else if (channel.type === 'D') {
                 isDirect = true;
                 if (this.state.users.length > 1) {
+                    let p;
                     if (this.state.users[0].id === currentId) {
-                        channelTitle = UserStore.getProfile(this.state.users[1].id).username;
+                        p = UserStore.getProfile(this.state.users[1].id);
                     } else {
-                        channelTitle = UserStore.getProfile(this.state.users[0].id).username;
+                        p = UserStore.getProfile(this.state.users[0].id);
+                    }
+                    if (p != null) {
+                        channelTitle = p.username;
                     }
                 }
             }
-- 
cgit v1.2.3-1-g7c22

