From 816eef170243ca95941143db33cb3901cba9265d Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Thu, 11 May 2017 14:35:33 -0700 Subject: [PATCH] fix(toolbox): Defensively check classNames when mapping button attributes --- react/features/toolbox/functions.web.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/react/features/toolbox/functions.web.js b/react/features/toolbox/functions.web.js index e12764591..6a207b0ea 100644 --- a/react/features/toolbox/functions.web.js +++ b/react/features/toolbox/functions.web.js @@ -21,13 +21,9 @@ export { abstractMapStateToProps } from './functions.native'; */ export function getButtonAttributesByProps(props: Object = {}) : MapOfAttributes { - let classNames = props.classNames; - - if (classNames) { - // XXX Make sure to not modify props.classNames because that'd be bad - // practice. - classNames = [ ...classNames ]; - } + // XXX Make sure to not modify props.classNames because that'd be bad + // practice. + const classNames = (props.classNames && [ ...props.classNames ]) || []; props.toggled && classNames.push('toggled'); props.unclickable && classNames.push('unclickable');