From e0815de2ad27d6e33a2ed8d76891ce2a5ac3f1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 23 Aug 2019 15:24:29 +0200 Subject: [PATCH] rn,welcome: fix accessing local participant It need not always exist, since it's created asynchronousluy on app initiualization. Make sure we are ready for it. I've seen backtraces because of this. --- .../welcome/components/WelcomePageSideBar.native.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/react/features/welcome/components/WelcomePageSideBar.native.js b/react/features/welcome/components/WelcomePageSideBar.native.js index faf6bb7e3..761e97520 100644 --- a/react/features/welcome/components/WelcomePageSideBar.native.js +++ b/react/features/welcome/components/WelcomePageSideBar.native.js @@ -44,12 +44,12 @@ type Props = { /** * Display name of the local participant. */ - _displayName: string, + _displayName: ?string, /** * ID of the local participant. */ - _localParticipantId: string, + _localParticipantId: ?string, /** * Sets the side bar visible or hidden. @@ -157,10 +157,12 @@ class WelcomePageSideBar extends Component { */ function _mapStateToProps(state: Object) { const _localParticipant = getLocalParticipant(state); + const _localParticipantId = _localParticipant?.id; + const _displayName = _localParticipant && getParticipantDisplayName(state, _localParticipantId); return { - _displayName: getParticipantDisplayName(state, _localParticipant.id), - _localParticipantId: _localParticipant.id, + _displayName, + _localParticipantId, _visible: state['features/welcome'].sideBarVisible }; }