Browse Source

fix(toolbox): Defensively check classNames when mapping button attributes

j8
Leonard Kim 8 years ago
parent
commit
816eef1702
1 changed files with 3 additions and 7 deletions
  1. 3
    7
      react/features/toolbox/functions.web.js

+ 3
- 7
react/features/toolbox/functions.web.js View File

@@ -21,13 +21,9 @@ export { abstractMapStateToProps } from './functions.native';
21 21
  */
22 22
 export function getButtonAttributesByProps(props: Object = {})
23 23
         : MapOfAttributes {
24
-    let classNames = props.classNames;
25
-
26
-    if (classNames) {
27
-        // XXX Make sure to not modify props.classNames because that'd be bad
28
-        // practice.
29
-        classNames = [ ...classNames ];
30
-    }
24
+    // XXX Make sure to not modify props.classNames because that'd be bad
25
+    // practice.
26
+    const classNames = (props.classNames && [ ...props.classNames ]) || [];
31 27
 
32 28
     props.toggled && classNames.push('toggled');
33 29
     props.unclickable && classNames.push('unclickable');

Loading…
Cancel
Save