浏览代码

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.
master
Saúl Ibarra Corretgé 6 年前
父节点
当前提交
e0815de2ad
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6
    4
      react/features/welcome/components/WelcomePageSideBar.native.js

+ 6
- 4
react/features/welcome/components/WelcomePageSideBar.native.js 查看文件

@@ -44,12 +44,12 @@ type Props = {
44 44
     /**
45 45
      * Display name of the local participant.
46 46
      */
47
-    _displayName: string,
47
+    _displayName: ?string,
48 48
 
49 49
     /**
50 50
      * ID of the local participant.
51 51
      */
52
-    _localParticipantId: string,
52
+    _localParticipantId: ?string,
53 53
 
54 54
     /**
55 55
      * Sets the side bar visible or hidden.
@@ -157,10 +157,12 @@ class WelcomePageSideBar extends Component<Props> {
157 157
  */
158 158
 function _mapStateToProps(state: Object) {
159 159
     const _localParticipant = getLocalParticipant(state);
160
+    const _localParticipantId = _localParticipant?.id;
161
+    const _displayName = _localParticipant && getParticipantDisplayName(state, _localParticipantId);
160 162
 
161 163
     return {
162
-        _displayName: getParticipantDisplayName(state, _localParticipant.id),
163
-        _localParticipantId: _localParticipant.id,
164
+        _displayName,
165
+        _localParticipantId,
164 166
         _visible: state['features/welcome'].sideBarVisible
165 167
     };
166 168
 }

正在加载...
取消
保存