diff options
author | JoramWilander <jwawilander@gmail.com> | 2016-02-01 08:01:49 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2016-02-01 08:01:49 -0500 |
commit | 12efe8675e5f0591308c10949174e64e42eb1f04 (patch) | |
tree | 197416e8072c45f5da6eddf8e98d0f0b93860f2d /web/react | |
parent | 0b022b130a6a4d4c3984fc7d021b2817b56480a1 (diff) | |
download | chat-12efe8675e5f0591308c10949174e64e42eb1f04.tar.gz chat-12efe8675e5f0591308c10949174e64e42eb1f04.tar.bz2 chat-12efe8675e5f0591308c10949174e64e42eb1f04.zip |
Fix console errors
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/navbar.jsx | 8 | ||||
-rw-r--r-- | web/react/components/sidebar.jsx | 5 |
2 files changed, 10 insertions, 3 deletions
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; } } } 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(); |